!function (e, t) {
  "object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : (e = e || self).TIM = t()
}(this, (function () {
  var e = {
    SDK_READY: "sdkStateReady",
    SDK_NOT_READY: "sdkStateNotReady",
    SDK_DESTROY: "sdkDestroy",
    MESSAGE_RECEIVED: "onMessageReceived",
    MESSAGE_REVOKED: "onMessageRevoked",
    CONVERSATION_LIST_UPDATED: "onConversationListUpdated",
    GROUP_LIST_UPDATED: "onGroupListUpdated",
    GROUP_SYSTEM_NOTICE_RECEIVED: "receiveGroupSystemNotice",
    PROFILE_UPDATED: "onProfileUpdated",
    BLACKLIST_UPDATED: "blacklistUpdated",
    KICKED_OUT: "kickedOut",
    ERROR: "error"
  }, t = {
    MSG_TEXT: "TIMTextElem",
    MSG_IMAGE: "TIMImageElem",
    MSG_SOUND: "TIMSoundElem",
    MSG_AUDIO: "TIMSoundElem",
    MSG_FILE: "TIMFileElem",
    MSG_FACE: "TIMFaceElem",
    MSG_VIDEO: "TIMVideoFileElem",
    MSG_GEO: "TIMLocationElem",
    MSG_GRP_TIP: "TIMGroupTipElem",
    MSG_GRP_SYS_NOTICE: "TIMGroupSystemNoticeElem",
    MSG_CUSTOM: "TIMCustomElem",
    MSG_PRIORITY_HIGH: "High",
    MSG_PRIORITY_NORMAL: "Normal",
    MSG_PRIORITY_LOW: "Low",
    MSG_PRIORITY_LOWEST: "Lowest",
    CONV_C2C: "C2C",
    CONV_GROUP: "GROUP",
    CONV_SYSTEM: "@TIM#SYSTEM",
    GRP_PRIVATE: "Private",
    GRP_PUBLIC: "Public",
    GRP_CHATROOM: "ChatRoom",
    GRP_AVCHATROOM: "AVChatRoom",
    GRP_MBR_ROLE_OWNER: "Owner",
    GRP_MBR_ROLE_ADMIN: "Admin",
    GRP_MBR_ROLE_MEMBER: "Member",
    GRP_TIP_MBR_JOIN: 1,
    GRP_TIP_MBR_QUIT: 2,
    GRP_TIP_MBR_KICKED_OUT: 3,
    GRP_TIP_MBR_SET_ADMIN: 4,
    GRP_TIP_MBR_CANCELED_ADMIN: 5,
    GRP_TIP_GRP_PROFILE_UPDATED: 6,
    GRP_TIP_MBR_PROFILE_UPDATED: 7,
    MSG_REMIND_ACPT_AND_NOTE: "AcceptAndNotify",
    MSG_REMIND_ACPT_NOT_NOTE: "AcceptNotNotify",
    MSG_REMIND_DISCARD: "Discard",
    GENDER_UNKNOWN: "Gender_Type_Unknown",
    GENDER_FEMALE: "Gender_Type_Female",
    GENDER_MALE: "Gender_Type_Male",
    KICKED_OUT_MULT_ACCOUNT: "mutipleAccount",
    KICKED_OUT_MULT_DEVICE: "mutipleDevice",
    KICKED_OUT_USERSIG_EXPIRED: "userSigExpired",
    ALLOW_TYPE_ALLOW_ANY: "AllowType_Type_AllowAny",
    ALLOW_TYPE_NEED_CONFIRM: "AllowType_Type_NeedConfirm",
    ALLOW_TYPE_DENY_ANY: "AllowType_Type_DenyAny",
    FORBID_TYPE_NONE: "AdminForbid_Type_None",
    FORBID_TYPE_SEND_OUT: "AdminForbid_Type_SendOut",
    JOIN_OPTIONS_FREE_ACCESS: "FreeAccess",
    JOIN_OPTIONS_NEED_PERMISSION: "NeedPermission",
    JOIN_OPTIONS_DISABLE_APPLY: "DisableApply",
    JOIN_STATUS_SUCCESS: "JoinedSuccess",
    JOIN_STATUS_ALREADY_IN_GROUP: "AlreadyInGroup",
    JOIN_STATUS_WAIT_APPROVAL: "WaitAdminApproval",
    GRP_PROFILE_OWNER_ID: "ownerID",
    GRP_PROFILE_CREATE_TIME: "createTime",
    GRP_PROFILE_LAST_INFO_TIME: "lastInfoTime",
    GRP_PROFILE_MEMBER_NUM: "memberNum",
    GRP_PROFILE_MAX_MEMBER_NUM: "maxMemberNum",
    GRP_PROFILE_JOIN_OPTION: "joinOption",
    GRP_PROFILE_INTRODUCTION: "introduction",
    GRP_PROFILE_NOTIFICATION: "notification"
  };

  function n(e) {
    return (n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) {
      return typeof e
    } : function (e) {
      return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e
    })(e)
  }

  function r(e, t) {
    if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
  }

  function o(e, t) {
    for (var n = 0; n < t.length; n++) {
      var r = t[n];
      r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
    }
  }

  function i(e, t, n) {
    return t && o(e.prototype, t), n && o(e, n), e
  }

  function s(e, t, n) {
    return t in e ? Object.defineProperty(e, t, {
      value: n,
      enumerable: !0,
      configurable: !0,
      writable: !0
    }) : e[t] = n, e
  }

  function a(e, t) {
    var n = Object.keys(e);
    if (Object.getOwnPropertySymbols) {
      var r = Object.getOwnPropertySymbols(e);
      t && (r = r.filter((function (t) {
        return Object.getOwnPropertyDescriptor(e, t).enumerable
      }))), n.push.apply(n, r)
    }
    return n
  }

  function u(e) {
    for (var t = 1; t < arguments.length; t++) {
      var n = null != arguments[t] ? arguments[t] : {};
      t % 2 ? a(Object(n), !0).forEach((function (t) {
        s(e, t, n[t])
      })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : a(Object(n)).forEach((function (t) {
        Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t))
      }))
    }
    return e
  }

  function c(e, t) {
    if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
    e.prototype = Object.create(t && t.prototype, {
      constructor: {
        value: e,
        writable: !0,
        configurable: !0
      }
    }), t && p(e, t)
  }

  function l(e) {
    return (l = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
      return e.__proto__ || Object.getPrototypeOf(e)
    })(e)
  }

  function p(e, t) {
    return (p = Object.setPrototypeOf || function (e, t) {
      return e.__proto__ = t, e
    })(e, t)
  }

  function h() {
    if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
    if (Reflect.construct.sham) return !1;
    if ("function" == typeof Proxy) return !0;
    try {
      return Date.prototype.toString.call(Reflect.construct(Date, [], (function () {
      }))), !0
    } catch (e) {
      return !1
    }
  }

  function f(e, t, n) {
    return (f = h() ? Reflect.construct : function (e, t, n) {
      var r = [null];
      r.push.apply(r, t);
      var o = new (Function.bind.apply(e, r));
      return n && p(o, n.prototype), o
    }).apply(null, arguments)
  }

  function g(e) {
    var t = "function" == typeof Map ? new Map : void 0;
    return (g = function (e) {
      if (null === e || (n = e, -1 === Function.toString.call(n).indexOf("[native code]"))) return e;
      var n;
      if ("function" != typeof e) throw new TypeError("Super expression must either be null or a function");
      if (void 0 !== t) {
        if (t.has(e)) return t.get(e);
        t.set(e, r)
      }

      function r() {
        return f(e, arguments, l(this).constructor)
      }

      return r.prototype = Object.create(e.prototype, {
        constructor: {
          value: r,
          enumerable: !1,
          writable: !0,
          configurable: !0
        }
      }), p(r, e)
    })(e)
  }

  function d(e) {
    if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
    return e
  }

  function m(e, t) {
    return !t || "object" != typeof t && "function" != typeof t ? d(e) : t
  }

  function y(e, t) {
    return function (e) {
      if (Array.isArray(e)) return e
    }(e) || function (e, t) {
      if (!(Symbol.iterator in Object(e) || "[object Arguments]" === Object.prototype.toString.call(e))) return;
      var n = [], r = !0, o = !1, i = void 0;
      try {
        for (var s, a = e[Symbol.iterator](); !(r = (s = a.next()).done) && (n.push(s.value), !t || n.length !== t); r = !0) ;
      } catch (u) {
        o = !0, i = u
      } finally {
        try {
          r || null == a.return || a.return()
        } finally {
          if (o) throw i
        }
      }
      return n
    }(e, t) || function () {
      throw new TypeError("Invalid attempt to destructure non-iterable instance")
    }()
  }

  function v(e) {
    return function (e) {
      if (Array.isArray(e)) {
        for (var t = 0, n = new Array(e.length); t < e.length; t++) n[t] = e[t];
        return n
      }
    }(e) || function (e) {
      if (Symbol.iterator in Object(e) || "[object Arguments]" === Object.prototype.toString.call(e)) return Array.from(e)
    }(e) || function () {
      throw new TypeError("Invalid attempt to spread non-iterable instance")
    }()
  }

  var _ = function () {
      function e() {
        r(this, e), this.cache = [], this.options = null
      }

      return i(e, [{
        key: "use", value: function (e) {
          if ("function" != typeof e) throw"middleware must be a function";
          return this.cache.push(e), this
        }
      }, {
        key: "next", value: function (e) {
          if (this.middlewares && this.middlewares.length > 0) return this.middlewares.shift().call(this, this.options, this.next.bind(this))
        }
      }, {
        key: "run", value: function (e) {
          return this.middlewares = this.cache.map((function (e) {
            return e
          })), this.options = e, this.next()
        }
      }]), e
    }(),
    M = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : {};

  function C(e, t) {
    return e(t = {exports: {}}, t.exports), t.exports
  }

  var I, S, D, k = C((function (e, t) {
      var n, r, o, i, s, a, u, c, l, p, h, f, g, d, m, y, v, _;
      e.exports = (n = "function" == typeof Promise, r = "object" == typeof self ? self : M, o = "undefined" != typeof Symbol, i = "undefined" != typeof Map, s = "undefined" != typeof Set, a = "undefined" != typeof WeakMap, u = "undefined" != typeof WeakSet, c = "undefined" != typeof DataView, l = o && void 0 !== Symbol.iterator, p = o && void 0 !== Symbol.toStringTag, h = s && "function" == typeof Set.prototype.entries, f = i && "function" == typeof Map.prototype.entries, g = h && Object.getPrototypeOf((new Set).entries()), d = f && Object.getPrototypeOf((new Map).entries()), m = l && "function" == typeof Array.prototype[Symbol.iterator], y = m && Object.getPrototypeOf([][Symbol.iterator]()), v = l && "function" == typeof String.prototype[Symbol.iterator], _ = v && Object.getPrototypeOf(""[Symbol.iterator]()), function (e) {
        var t = typeof e;
        if ("object" !== t) return t;
        if (null === e) return "null";
        if (e === r) return "global";
        if (Array.isArray(e) && (!1 === p || !(Symbol.toStringTag in e))) return "Array";
        if ("object" == typeof window && null !== window) {
          if ("object" == typeof window.location && e === window.location) return "Location";
          if ("object" == typeof window.document && e === window.document) return "Document";
          if ("object" == typeof window.navigator) {
            if ("object" == typeof window.navigator.mimeTypes && e === window.navigator.mimeTypes) return "MimeTypeArray";
            if ("object" == typeof window.navigator.plugins && e === window.navigator.plugins) return "PluginArray"
          }
          if (("function" == typeof window.HTMLElement || "object" == typeof window.HTMLElement) && e instanceof window.HTMLElement) {
            if ("BLOCKQUOTE" === e.tagName) return "HTMLQuoteElement";
            if ("TD" === e.tagName) return "HTMLTableDataCellElement";
            if ("TH" === e.tagName) return "HTMLTableHeaderCellElement"
          }
        }
        var o = p && e[Symbol.toStringTag];
        if ("string" == typeof o) return o;
        var l = Object.getPrototypeOf(e);
        return l === RegExp.prototype ? "RegExp" : l === Date.prototype ? "Date" : n && l === Promise.prototype ? "Promise" : s && l === Set.prototype ? "Set" : i && l === Map.prototype ? "Map" : u && l === WeakSet.prototype ? "WeakSet" : a && l === WeakMap.prototype ? "WeakMap" : c && l === DataView.prototype ? "DataView" : i && l === d ? "Map Iterator" : s && l === g ? "Set Iterator" : m && l === y ? "Array Iterator" : v && l === _ ? "String Iterator" : null === l ? "Object" : Object.prototype.toString.call(e).slice(8, -1)
      })
    })), T = "undefined" != typeof window,
    E = "undefined" != typeof wx && "function" == typeof wx.getSystemInfoSync && "function" == typeof wx.canIUse,
    w = T && window.navigator && window.navigator.userAgent || "", A = /AppleWebKit\/([\d.]+)/i.exec(w),
    R = (A && parseFloat(A.pop()), /iPad/i.test(w)),
    L = (/iPhone/i.test(w), /iPod/i.test(w), (I = w.match(/OS (\d+)_/i)) && I[1] && I[1], /Android/i.test(w)),
    P = function () {
      var e = w.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);
      if (!e) return null;
      var t = e[1] && parseFloat(e[1]), n = e[2] && parseFloat(e[2]);
      return t && n ? parseFloat(e[1] + "." + e[2]) : t || null
    }(), b = (L && /webkit/i.test(w), /Firefox/i.test(w), /Edge/i.test(w)), O = !b && /Chrome/i.test(w),
    N = (function () {
      var e = w.match(/Chrome\/(\d+)/);
      e && e[1] && parseFloat(e[1])
    }(), /MSIE/.test(w)), G = (/MSIE\s8\.0/.test(w), function () {
      var e = /MSIE\s(\d+)\.\d/.exec(w), t = e && parseFloat(e[1]);
      return !t && /Trident\/7.0/i.test(w) && /rv:11.0/.test(w) && (t = 11), t
    }()), U = (/Safari/i.test(w), /TBS\/\d+/i.test(w)), q = (function () {
      var e = w.match(/TBS\/(\d+)/i);
      if (e && e[1]) e[1]
    }(), !U && /MQQBrowser\/\d+/i.test(w), !U && / QQBrowser\/\d+/i.test(w), /(micromessenger|webbrowser)/i.test(w)),
    x = (/Windows/i.test(w), /MAC OS X/i.test(w), /MicroMessenger/i.test(w), "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {});
  S = "undefined" != typeof console ? console : void 0 !== x && x.console ? x.console : "undefined" != typeof window && window.console ? window.console : {};
  for (var F = function () {
  }, H = ["assert", "clear", "count", "debug", "dir", "dirxml", "error", "exception", "group", "groupCollapsed", "groupEnd", "info", "log", "markTimeline", "profile", "profileEnd", "table", "time", "timeEnd", "timeStamp", "trace", "warn"], B = H.length; B--;) D = H[B], console[D] || (S[D] = F);
  S.methods = H;
  var K = S, V = 0, j = function () {
    if (E) {
      var e = wx.getSystemInfoSync().SDKVersion;
      if (void 0 === e || void 0 === wx.getLogManager) return !1;
      if (function (e, t) {
        e = e.split("."), t = t.split(".");
        var n = Math.max(e.length, t.length);
        for (; e.length < n;) e.push("0");
        for (; t.length < n;) t.push("0");
        for (var r = 0; r < n; r++) {
          var o = parseInt(e[r]), i = parseInt(t[r]);
          if (o > i) return 1;
          if (o < i) return -1
        }
        return 0
      }(e, "2.1.0") >= 0) return wx.getLogManager().log("I can use wx log. SDKVersion=" + e), !0
    }
    return !1
  }(), $ = new Map;

  function Y() {
    var e = new Date;
    return "TIM " + e.toLocaleTimeString("en-US", {hour12: !1}) + "." + function (e) {
      var t;
      switch (e.toString().length) {
        case 1:
          t = "00" + e;
          break;
        case 2:
          t = "0" + e;
          break;
        default:
          t = e
      }
      return t
    }(e.getMilliseconds()) + ":"
  }

  var z = {
    _data: [], _length: 0, _visible: !1, arguments2String: function (e) {
      var t;
      if (1 === e.length) t = Y() + e[0]; else {
        t = Y();
        for (var n = 0, r = e.length; n < r; n++) ne(e[n]) ? oe(e[n]) ? t += le(e[n]) : t += JSON.stringify(e[n]) : t += e[n], t += " "
      }
      return t
    }, debug: function () {
      if (V <= -1) {
        var e = this.arguments2String(arguments);
        z.record(e, "debug"), K.debug(e), j && wx.getLogManager().debug(e)
      }
    }, log: function () {
      if (V <= 0) {
        var e = this.arguments2String(arguments);
        z.record(e, "log"), K.log(e), j && wx.getLogManager().log(e)
      }
    }, info: function () {
      if (V <= 1) {
        var e = this.arguments2String(arguments);
        z.record(e, "info"), K.info(e), j && wx.getLogManager().info(e)
      }
    }, warn: function () {
      if (V <= 2) {
        var e = this.arguments2String(arguments);
        z.record(e, "warn"), K.warn(e), j && wx.getLogManager().warn(e)
      }
    }, error: function () {
      if (V <= 3) {
        var e = this.arguments2String(arguments);
        z.record(e, "error"), K.error(e), j && wx.getLogManager().warn(e)
      }
    }, time: function (e) {
      $.set(e, ue.now())
    }, timeEnd: function (e) {
      if ($.has(e)) {
        var t = ue.now() - $.get(e);
        return $.delete(e), t
      }
      return K.warn("未找到对应label: ".concat(e, ", 请在调用 logger.timeEnd 前，调用 logger.time")), 0
    }, setLevel: function (e) {
      e < 4 && K.log(Y() + "set level from " + V + " to " + e), V = e
    }, record: function (e, t) {
      j || (1100 === z._length && (z._data.splice(0, 100), z._length = 1e3), z._length++, z._data.push("".concat(e, " [").concat(t, "] \n")))
    }, getLog: function () {
      return z._data
    }
  }, W = function (e) {
    return "file" === ie(e)
  }, X = function (e) {
    return null !== e && ("number" == typeof e && !isNaN(e - 0) || "object" === n(e) && e.constructor === Number)
  }, J = function (e) {
    return "string" == typeof e
  }, Q = function (e) {
    return null !== e && "object" === n(e)
  }, Z = function (e) {
    if ("object" !== n(e) || null === e) return !1;
    var t = Object.getPrototypeOf(e);
    if (null === t) return !0;
    for (var r = t; null !== Object.getPrototypeOf(r);) r = Object.getPrototypeOf(r);
    return t === r
  }, ee = function (e) {
    return "function" == typeof Array.isArray ? Array.isArray(e) : "array" === ie(e)
  }, te = function (e) {
    return void 0 === e
  }, ne = function (e) {
    return ee(e) || Q(e)
  }, re = function (e) {
    return "function" == typeof e
  }, oe = function (e) {
    return e instanceof Error
  }, ie = function (e) {
    return Object.prototype.toString.call(e).match(/^\[object (.*)\]$/)[1].toLowerCase()
  }, se = function (e) {
    if ("string" != typeof e) return !1;
    var t = e[0];
    return !/[^a-zA-Z0-9]/.test(t)
  }, ae = 0;
  Date.now || (Date.now = function () {
    return (new Date).getTime()
  });
  var ue = {
    now: function () {
      0 === ae && (ae = Date.now() - 1);
      var e = Date.now() - ae;
      return e > 4294967295 ? (ae += 4294967295, Date.now() - ae) : e
    }, utc: function () {
      return Math.round(Date.now() / 1e3)
    }
  }, ce = function e(t, n, r, o) {
    if (!ne(t) || !ne(n)) return 0;
    for (var i, s = 0, a = Object.keys(n), u = 0, c = a.length; u < c; u++) if (i = a[u], !(te(n[i]) || r && r.includes(i))) if (ne(t[i]) && ne(n[i])) s += e(t[i], n[i], r, o); else {
      if (o && o.includes(n[i])) continue;
      t[i] !== n[i] && (t[i] = n[i], s += 1)
    }
    return s
  }, le = function (e) {
    return JSON.stringify(e, ["message", "code"])
  }, pe = function () {
    var e = new Date, t = e.toISOString(), n = e.getTimezoneOffset() / 60, r = "";
    return r = n < 0 ? n > -10 ? "+0" + Math.abs(100 * n) : "+" + Math.abs(100 * n) : n >= 10 ? "-" + 100 * n : "-0" + 100 * n, t.replace("Z", r)
  }, he = function (e) {
    if (0 === e.length) return 0;
    for (var t = 0, n = 0, r = "undefined" != typeof document && void 0 !== document.characterSet ? document.characterSet : "UTF-8"; void 0 !== e[t];) n += e[t++].charCodeAt[t] <= 255 ? 1 : !1 === r ? 3 : 2;
    return n
  }, fe = function (e) {
    var t = e || 99999999;
    return Math.round(Math.random() * t)
  }, ge = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", de = ge.length, me = function (e, t) {
    for (var n in e) if (e[n] === t) return !0;
    return !1
  }, ye = {}, ve = function () {
    if (E) return "https:";
    var e = window.location.protocol;
    return ["http:", "https:"].indexOf(e) < 0 && (e = "http:"), e
  }, _e = function (e) {
    return -1 === e.indexOf("http://") || -1 === e.indexOf("https://") ? "https://" + e : e.replace(/https|http/, "https")
  };

  function Me(e, t) {
    ee(e) && ee(t) ? t.forEach((function (t) {
      var n = t.key, r = t.value, o = e.find((function (e) {
        return e.key === n
      }));
      o ? o.value = r : e.push({key: n, value: r})
    })) : z.warn("updateCustomField target 或 source 不是数组，忽略此次更新。")
  }

  var Ce = function (e) {
    return e === t.GRP_PUBLIC
  }, Ie = function (e) {
    return e === t.GRP_AVCHATROOM
  }, Se = function (e) {
    return J(e) && e === t.CONV_SYSTEM
  };

  function De(e, t) {
    var n = {};
    return Object.keys(e).forEach((function (r) {
      n[r] = t(e[r], r)
    })), n
  }

  var ke = Object.prototype.hasOwnProperty;

  function Te(e) {
    if (null == e) return !0;
    if ("boolean" == typeof e) return !1;
    if ("number" == typeof e) return 0 === e;
    if ("string" == typeof e) return 0 === e.length;
    if ("function" == typeof e) return 0 === e.length;
    if (Array.isArray(e)) return 0 === e.length;
    if (e instanceof Error) return "" === e.message;
    if (Z(e)) {
      for (var t in e) if (ke.call(e, t)) return !1;
      return !0
    }
    return !("map" !== ie(e) && !function (e) {
      return "set" === ie(e)
    }(e) && !W(e)) && 0 === e.size
  }

  function Ee(e, t, n) {
    if (void 0 === t) return !0;
    var r = !0;
    if ("object" === k(t).toLowerCase()) Object.keys(t).forEach((function (o) {
      var i = 1 === e.length ? e[0][o] : void 0;
      r = !!we(i, t[o], n, o) && r
    })); else if ("array" === k(t).toLowerCase()) for (var o = 0; o < t.length; o++) r = !!we(e[o], t[o], n, t[o].name) && r;
    if (r) return r;
    throw new Error("Params validate failed.")
  }

  function we(e, t, n, r) {
    if (void 0 === t) return !0;
    var o = !0;
    return t.required && Te(e) && (K.error("TIM [".concat(n, '] Missing required params: "').concat(r, '".')), o = !1), Te(e) || k(e).toLowerCase() === t.type.toLowerCase() || (K.error("TIM [".concat(n, '] Invalid params: type check failed for "').concat(r, '".Expected ').concat(t.type, ".")), o = !1), t.validator && !t.validator(e) && (K.error("TIM [".concat(n, "] Invalid params: custom validator check failed for params.")), o = !1), o
  }

  var Ae = {SUCCESS: "JoinedSuccess", WAIT_APPROVAL: "WaitAdminApproval"}, Re = {SUCCESS: 0},
    Le = {IS_LOGIN: 1, IS_NOT_LOGIN: 0}, Pe = {UNSEND: "unSend", SUCCESS: "success", FAIL: "fail"},
    be = {SIGN_IN: !0, SIGN_OUT: !1}, Oe = {ONLINE: !0, OFFLINE: !1},
    Ne = {NOT_START: "notStart", PENDING: "pengding", RESOLVED: "resolved", REJECTED: "rejected"}, Ge = function () {
      function e(n) {
        r(this, e), this.type = t.MSG_TEXT, this.content = {text: n.text || ""}
      }

      return i(e, [{
        key: "setText", value: function (e) {
          this.content.text = e
        }
      }, {
        key: "sendable", value: function () {
          return 0 !== this.content.text.length
        }
      }]), e
    }(), Ue = {
      JSON: {
        TYPE: {
          C2C: {NOTICE: 1, COMMON: 9, EVENT: 10},
          GROUP: {COMMON: 3, TIP: 4, SYSTEM: 5, TIP2: 6},
          FRIEND: {NOTICE: 7},
          PROFILE: {NOTICE: 8}
        },
        SUBTYPE: {C2C: {COMMON: 0, READED: 92, KICKEDOUT: 96}, GROUP: {COMMON: 0, LOVEMESSAGE: 1, TIP: 2, REDPACKET: 3}},
        OPTIONS: {
          GROUP: {
            JOIN: 1,
            QUIT: 2,
            KICK: 3,
            SET_ADMIN: 4,
            CANCEL_ADMIN: 5,
            MODIFY_GROUP_INFO: 6,
            MODIFY_MEMBER_INFO: 7
          }
        }
      },
      PROTOBUF: {},
      IMAGE_TYPES: {ORIGIN: 1, LARGE: 2, SMALL: 3},
      IMAGE_FORMAT: {JPG: 1, JPEG: 1, GIF: 2, PNG: 3, BMP: 4, UNKNOWN: 255}
    }, qe = 1, xe = 2, Fe = 3, He = 4, Be = 5, Ke = 7, Ve = 8, je = 9, $e = 10, Ye = 15, ze = 255, We = 2, Xe = 0, Je = 1,
    Qe = {
      NICK: "Tag_Profile_IM_Nick",
      GENDER: "Tag_Profile_IM_Gender",
      BIRTHDAY: "Tag_Profile_IM_BirthDay",
      LOCATION: "Tag_Profile_IM_Location",
      SELFSIGNATURE: "Tag_Profile_IM_SelfSignature",
      ALLOWTYPE: "Tag_Profile_IM_AllowType",
      LANGUAGE: "Tag_Profile_IM_Language",
      AVATAR: "Tag_Profile_IM_Image",
      MESSAGESETTINGS: "Tag_Profile_IM_MsgSettings",
      ADMINFORBIDTYPE: "Tag_Profile_IM_AdminForbidType",
      LEVEL: "Tag_Profile_IM_Level",
      ROLE: "Tag_Profile_IM_Role"
    }, Ze = {UNKNOWN: "Gender_Type_Unknown", FEMALE: "Gender_Type_Female", MALE: "Gender_Type_Male"},
    et = {NONE: "AdminForbid_Type_None", SEND_OUT: "AdminForbid_Type_SendOut"}, tt = {
      NEED_CONFIRM: "AllowType_Type_NeedConfirm",
      ALLOW_ANY: "AllowType_Type_AllowAny",
      DENY_ANY: "AllowType_Type_DenyAny"
    }, nt = function () {
      function e(n) {
        r(this, e), this._imageMemoryURL = "", this._file = n.file, E ? this.createImageDataASURLInWXMiniApp(n.file) : this.createImageDataASURLInWeb(n.file), this._initImageInfoModel(), this.type = t.MSG_IMAGE, this._percent = 0, this.content = {
          imageFormat: Ue.IMAGE_FORMAT[n.imageFormat] || Ue.IMAGE_FORMAT.UNKNOWN,
          uuid: n.uuid,
          imageInfoArray: []
        }, this.initImageInfoArray(n.imageInfoArray), this._defaultImage = "http://imgcache.qq.com/open/qcloud/video/act/webim-images/default.jpg", this._autoFixUrl()
      }

      return i(e, [{
        key: "_initImageInfoModel", value: function () {
          var e = this;
          this._ImageInfoModel = function (t) {
            this.instanceID = fe(9999999), this.sizeType = t.type || 0, this.size = t.size || 0, this.width = t.width || 0, this.height = t.height || 0, this.imageUrl = t.url || "", this.url = t.url || e._imageMemoryURL || e._defaultImage
          }, this._ImageInfoModel.prototype = {
            setSizeType: function (e) {
              this.sizeType = e
            }, setImageUrl: function (e) {
              e && (this.imageUrl = e)
            }, getImageUrl: function () {
              return this.imageUrl
            }
          }
        }
      }, {
        key: "initImageInfoArray", value: function (e) {
          for (var t = 2, n = null, r = null; t >= 0;) r = void 0 === e || void 0 === e[t] ? {
            type: 0,
            size: 0,
            width: 0,
            height: 0,
            url: ""
          } : e[t], (n = new this._ImageInfoModel(r)).setSizeType(t + 1), this.addImageInfo(n), t--
        }
      }, {
        key: "updateImageInfoArray", value: function (e) {
          for (var t, n = this.content.imageInfoArray.length, r = 0; r < n; r++) t = this.content.imageInfoArray[r], e.size && (t.size = e.size), e.url && t.setImageUrl(e.url), e.width && (t.width = e.width), e.height && (t.height = e.height)
        }
      }, {
        key: "_autoFixUrl", value: function () {
          for (var e = this.content.imageInfoArray.length, t = "", n = "", r = ["http", "https"], o = null, i = 0; i < e; i++) this.content.imageInfoArray[i].url && "" !== (o = this.content.imageInfoArray[i]).imageUrl && (n = o.imageUrl.slice(0, o.imageUrl.indexOf("://") + 1), t = o.imageUrl.slice(o.imageUrl.indexOf("://") + 1), r.indexOf(n) < 0 && (n = "https:"), this.content.imageInfoArray[i].setImageUrl([n, t].join("")))
        }
      }, {
        key: "updatePercent", value: function (e) {
          this._percent = e, this._percent > 1 && (this._percent = 1)
        }
      }, {
        key: "updateImageFormat", value: function (e) {
          this.content.imageFormat = e
        }
      }, {
        key: "createImageDataASURLInWeb", value: function (e) {
          void 0 !== e && e.files.length > 0 && (this._imageMemoryURL = window.URL.createObjectURL(e.files[0]))
        }
      }, {
        key: "createImageDataASURLInWXMiniApp", value: function (e) {
          e && e.url && (this._imageMemoryURL = e.url)
        }
      }, {
        key: "replaceImageInfo", value: function (e, t) {
          this.content.imageInfoArray[t] instanceof this._ImageInfoModel || (this.content.imageInfoArray[t] = e)
        }
      }, {
        key: "addImageInfo", value: function (e) {
          this.content.imageInfoArray.length >= 3 || this.content.imageInfoArray.push(e)
        }
      }, {
        key: "sendable", value: function () {
          return 0 !== this.content.imageInfoArray.length && ("" !== this.content.imageInfoArray[0].imageUrl && 0 !== this.content.imageInfoArray[0].size)
        }
      }]), e
    }(), rt = function () {
      function e(n) {
        r(this, e), this.type = t.MSG_FACE, this.content = n || null
      }

      return i(e, [{
        key: "sendable", value: function () {
          return null !== this.content
        }
      }]), e
    }(), ot = function () {
      function e(n) {
        r(this, e), this.type = t.MSG_AUDIO, this._percent = 0, this.content = {
          downloadFlag: 2,
          second: n.second,
          size: n.size,
          url: n.url,
          remoteAudioUrl: "",
          uuid: n.uuid
        }
      }

      return i(e, [{
        key: "updatePercent", value: function (e) {
          this._percent = e, this._percent > 1 && (this._percent = 1)
        }
      }, {
        key: "updateAudioUrl", value: function (e) {
          this.content.remoteAudioUrl = e
        }
      }, {
        key: "sendable", value: function () {
          return "" !== this.content.remoteAudioUrl
        }
      }]), e
    }(), it = {from: !0, groupID: !0, groupName: !0, to: !0}, st = function () {
      function e(n) {
        r(this, e), this.type = t.MSG_GRP_TIP, this.content = {}, this._initContent(n)
      }

      return i(e, [{
        key: "_initContent", value: function (e) {
          var t = this;
          Object.keys(e).forEach((function (n) {
            switch (n) {
              case"remarkInfo":
                break;
              case"groupProfile":
                t.content.groupProfile = {}, t._initGroupProfile(e[n]);
                break;
              case"operatorInfo":
              case"memberInfoList":
                break;
              case"msgMemberInfo":
                t.content.memberList = e[n], Object.defineProperty(t.content, "msgMemberInfo", {
                  get: function () {
                    return z.warn("!!! 禁言的群提示消息中的 payload.msgMemberInfo 属性即将废弃，请使用 payload.memberList 属性替代。 \n", "msgMemberInfo 中的 shutupTime 属性对应更改为 memberList 中的 muteTime 属性，表示禁言时长。 \n", "参考：群提示消息 https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/Message.html#.GroupTipPayload"), t.content.memberList.map((function (e) {
                      return {userID: e.userID, shutupTime: e.muteTime}
                    }))
                  }
                });
                break;
              default:
                t.content[n] = e[n]
            }
          })), this.content.userIDList || (this.content.userIDList = [this.content.operatorID])
        }
      }, {
        key: "_initGroupProfile", value: function (e) {
          for (var t = Object.keys(e), n = 0; n < t.length; n++) {
            var r = t[n];
            it[r] && (this.content.groupProfile[r] = e[r])
          }
        }
      }]), e
    }(), at = {from: !0, groupID: !0, name: !0, to: !0}, ut = function () {
      function e(n) {
        r(this, e), this.type = t.MSG_GRP_SYS_NOTICE, this.content = {}, this._initContent(n)
      }

      return i(e, [{
        key: "_initContent", value: function (e) {
          var t = this;
          Object.keys(e).forEach((function (n) {
            switch (n) {
              case"memberInfoList":
                break;
              case"remarkInfo":
                t.content.handleMessage = e[n];
                break;
              case"groupProfile":
                t.content.groupProfile = {}, t._initGroupProfile(e[n]);
                break;
              default:
                t.content[n] = e[n]
            }
          }))
        }
      }, {
        key: "_initGroupProfile", value: function (e) {
          for (var t = Object.keys(e), n = 0; n < t.length; n++) {
            var r = t[n];
            at[r] && (this.content.groupProfile[r] = e[r])
          }
        }
      }]), e
    }(), ct = {
      70001: "UserSig 已过期，请重新生成。建议 UserSig 有效期设置不小于24小时。",
      70002: "UserSig 长度为0，请检查传入的 UserSig 是否正确。",
      70003: "UserSig 非法，请使用官网提供的 API 重新生成 UserSig(https://cloud.tencent.com/document/product/269/32688)。",
      70005: "UserSig 非法，请使用官网提供的 API 重新生成 UserSig(https://cloud.tencent.com/document/product/269/32688)。",
      70009: "UserSig 验证失败，可能因为生成 UserSig 时混用了其他 SDKAppID 的私钥或密钥导致，请使用对应 SDKAppID 下的私钥或密钥重新生成 UserSig(https://cloud.tencent.com/document/product/269/32688)。",
      70013: "请求中的 UserID 与生成 UserSig 时使用的 UserID 不匹配，您可以在即时通信 IM 控制台的【开发辅助工具(https://console.cloud.tencent.com/im-detail/tool-usersig)】页面校验 UserSig。",
      70014: "请求中的 SDKAppID 与生成 UserSig 时使用的 SDKAppID 不匹配，您可以在即时通信 IM 控制台的【开发辅助工具(https://console.cloud.tencent.com/im-detail/tool-usersig)】页面校验 UserSig。",
      70016: "密钥不存在，UserSig 验证失败，请在即时通信 IM 控制台获取密钥(https://cloud.tencent.com/document/product/269/32578#.E8.8E.B7.E5.8F.96.E5.AF.86.E9.92.A5)。",
      70020: "SDKAppID 未找到，请在即时通信 IM 控制台确认应用信息。",
      70050: "UserSig 验证次数过于频繁。请检查 UserSig 是否正确，并于1分钟后重新验证。您可以在即时通信 IM 控制台的【开发辅助工具(https://console.cloud.tencent.com/im-detail/tool-usersig)】页面校验 UserSig。",
      70051: "帐号被拉入黑名单。",
      70052: "UserSig 已经失效，请重新生成，再次尝试。",
      70107: "因安全原因被限制登录，请不要频繁登录。",
      70169: "请求的用户帐号不存在。",
      70114: "服务端内部超时，请稍后重试。",
      70202: "服务端内部超时，请稍后重试。",
      70206: "请求中批量数量不合法。",
      70402: "参数非法，请检查必填字段是否填充，或者字段的填充是否满足协议要求。",
      70403: "请求失败，需要 App 管理员权限。",
      70398: "帐号数超限。如需创建多于100个帐号，请将应用升级为专业版，具体操作指引请参见购买指引(https://cloud.tencent.com/document/product/269/32458)。",
      70500: "服务端内部错误，请稍后重试。",
      71e3: "删除帐号失败。仅支持删除体验版帐号，您当前应用为专业版，暂不支持帐号删除。",
      20001: "请求包非法。",
      20002: "UserSig 或 A2 失效。",
      20003: "消息发送方或接收方 UserID 无效或不存在，请检查 UserID 是否已导入即时通信 IM。",
      20004: "网络异常，请重试。",
      20005: "服务端内部错误，请重试。",
      20006: "触发发送单聊消息之前回调，App 后台返回禁止下发该消息。",
      20007: "发送单聊消息，被对方拉黑，禁止发送。消息发送状态默认展示为失败，您可以登录控制台修改该场景下的消息发送状态展示结果，具体操作请参见消息保留设置(https://cloud.tencent.com/document/product/269/38656)。",
      20009: "消息发送双方互相不是好友，禁止发送（配置单聊消息校验好友关系才会出现）。",
      20010: "发送单聊消息，自己不是对方的好友（单向关系），禁止发送。",
      20011: "发送单聊消息，对方不是自己的好友（单向关系），禁止发送。",
      20012: "发送方被禁言，该条消息被禁止发送。",
      20016: "消息撤回超过了时间限制（默认2分钟）。",
      20018: "删除漫游内部错误。",
      90001: "JSON 格式解析失败，请检查请求包是否符合 JSON 规范。",
      90002: "JSON 格式请求包中 MsgBody 不符合消息格式描述，或者 MsgBody 不是 Array 类型，请参考 TIMMsgElement 对象的定义(https://cloud.tencent.com/document/product/269/2720#.E6.B6.88.E6.81.AF.E5.85.83.E7.B4.A0-timmsgelement)。",
      90003: "JSON 格式请求包体中缺少 To_Account 字段或者 To_Account 帐号不存在。",
      90005: "JSON 格式请求包体中缺少 MsgRandom 字段或者 MsgRandom 字段不是 Integer 类型。",
      90006: "JSON 格式请求包体中缺少 MsgTimeStamp 字段或者 MsgTimeStamp 字段不是 Integer 类型。",
      90007: "JSON 格式请求包体中 MsgBody 类型不是 Array 类型，请将其修改为 Array 类型。",
      90008: "JSON 格式请求包体中缺少 From_Account 字段或者 From_Account 帐号不存在。",
      90009: "请求需要 App 管理员权限。",
      90010: "JSON 格式请求包不符合消息格式描述，请参考 TIMMsgElement 对象的定义(https://cloud.tencent.com/document/product/269/2720#.E6.B6.88.E6.81.AF.E5.85.83.E7.B4.A0-timmsgelement)。",
      90011: "批量发消息目标帐号超过500，请减少 To_Account 中目标帐号数量。",
      90012: "To_Account 没有注册或不存在，请确认 To_Account 是否导入即时通信 IM 或者是否拼写错误。",
      90026: "消息离线存储时间错误（最多不能超过7天）。",
      90031: "JSON 格式请求包体中 SyncOtherMachine 字段不是 Integer 类型。",
      90044: "JSON 格式请求包体中 MsgLifeTime 字段不是 Integer 类型。",
      90048: "请求的用户帐号不存在。",
      90054: "撤回请求中的 MsgKey 不合法。",
      90994: "服务内部错误，请重试。",
      90995: "服务内部错误，请重试。",
      91e3: "服务内部错误，请重试。",
      90992: "服务内部错误，请重试；如果所有请求都返回该错误码，且 App 配置了第三方回调，请检查 App 服务端是否正常向即时通信 IM 后台服务端返回回调结果。",
      93e3: "JSON 数据包超长，消息包体请不要超过8k。",
      91101: "Web 端长轮询被踢（Web 端同时在线实例个数超出限制）。",
      10002: "服务端内部错误，请重试。",
      10003: "请求中的接口名称错误，请核对接口名称并重试。",
      10004: "参数非法，请根据错误描述检查请求是否正确。",
      10005: "请求包体中携带的帐号数量过多。",
      10006: "操作频率限制，请尝试降低调用的频率。",
      10007: "操作权限不足，例如 Public 群组中普通成员尝试执行踢人操作，但只有 App 管理员才有权限。",
      10008: "请求非法，可能是请求中携带的签名信息验证不正确，请再次尝试。",
      10009: "该群不允许群主主动退出。",
      10010: "群组不存在，或者曾经存在过，但是目前已经被解散。",
      10011: "解析 JSON 包体失败，请检查包体的格式是否符合 JSON 格式。",
      10012: "发起操作的 UserID 非法，请检查发起操作的用户 UserID 是否填写正确。",
      10013: "被邀请加入的用户已经是群成员。",
      10014: "群已满员，无法将请求中的用户加入群组，如果是批量加人，可以尝试减少加入用户的数量。",
      10015: "群组 ID 非法，请检查群组 ID 是否填写正确。",
      10016: "App 后台通过第三方回调拒绝本次操作。",
      10017: "因被禁言而不能发送消息，请检查发送者是否被设置禁言。",
      10018: "应答包长度超过最大包长（1MB），请求的内容过多，请尝试减少单次请求的数据量。",
      10019: "请求的用户帐号不存在。",
      10021: "群组 ID 已被使用，请选择其他的群组 ID。",
      10023: "发消息的频率超限，请延长两次发消息时间的间隔。",
      10024: "此邀请或者申请请求已经被处理。",
      10025: "群组 ID 已被使用，并且操作者为群主，可以直接使用。",
      10026: "该 SDKAppID 请求的命令字已被禁用。",
      10030: "请求撤回的消息不存在。",
      10031: "消息撤回超过了时间限制（默认2分钟）。",
      10032: "请求撤回的消息不支持撤回操作。",
      10033: "群组类型不支持消息撤回操作。",
      10034: "该消息类型不支持删除操作。",
      10035: "音视频聊天室和在线成员广播大群不支持删除消息。",
      10036: "音视频聊天室创建数量超过了限制，请参考价格说明(https://cloud.tencent.com/document/product/269/11673)购买预付费套餐“IM音视频聊天室”。",
      10037: "单个用户可创建和加入的群组数量超过了限制，请参考价格说明(https://cloud.tencent.com/document/product/269/11673)购买或升级预付费套餐“单人可创建与加入群组数”。",
      10038: "群成员数量超过限制，请参考价格说明(https://cloud.tencent.com/document/product/269/11673)购买或升级预付费套餐“扩展群人数上限”。",
      10041: "该应用（SDKAppID）已配置不支持群消息撤回。"
    }, lt = function (e) {
      function t(e) {
        var n;
        return r(this, t), (n = m(this, l(t).call(this))).code = e.code, n.message = ct[e.code] || e.message, n.data = e.data || {}, n
      }

      return c(t, e), t
    }(g(Error)), pt = 2e3, ht = 2001, ft = 2002, gt = 2003, dt = 2004, mt = 2022, yt = 2023, vt = 2040, _t = 2100,
    Mt = 2103, Ct = 2105, It = 2106, St = 2108, Dt = 2109, kt = 2110, Tt = 2251, Et = 2252, wt = 2253, At = 2300,
    Rt = 2301, Lt = 2350, Pt = 2351, bt = 2352, Ot = 2400, Nt = 2401, Gt = 2402, Ut = 2403, qt = 2500, xt = 2501,
    Ft = 2502, Ht = 2600, Bt = 2601, Kt = 2620, Vt = 2621, jt = 2622, $t = 2660, Yt = 2661, zt = 2662, Wt = 2680,
    Xt = 2681, Jt = 2682, Qt = 2683, Zt = 2684, en = 2685, tn = 2700, nn = 2721, rn = 2722, on = 2740, sn = 2741,
    an = 2742, un = 2800, cn = 2801, ln = 2802, pn = 2803, hn = 2804, fn = 2805, gn = 2900, dn = 2901, mn = 2902,
    yn = 2903, vn = 2904, _n = 2999, Mn = 91101, Cn = 20002, In = 70001, Sn = 90001, Dn = "无 SDKAppID",
    kn = "无 accountType", Tn = "无 userID", En = "无 usersig", wn = "无 SDK 实例", An = "无tinyid", Rn = "无a2key",
    Ln = "未检测到 COS 上传插件", Pn = "消息发送失败", bn = "MessageController.constructor() 需要参数 options", On = "需要 Message 的实例",
    Nn = 'Message.conversationType 只能为 "C2C"或"GROUP" ', Gn = "无法发送空文件", Un = "回调函数运行时遇到错误，请检查接入侧代码", qn = "消息撤回失败",
    xn = "请先选择一个图片", Fn = "只允许上传 jpg png jpeg gif 格式的图片", Hn = "图片大小超过20M，无法发送", Bn = "语音上传失败", Kn = "语音大小大于20M，无法发送",
    Vn = "视频上传失败", jn = "视频大小超过20M，无法发送", $n = "只允许上传 mp4 格式的视频", Yn = "文件上传失败", zn = "请先选择一个文件",
    Wn = "文件大小超过100M，无法发送 ", Xn = "缺少必要的参数文件 URL", Jn = "没有找到相应的会话，请检查传入参数", Qn = "没有找到相应的用户或群组，请检查传入参数",
    Zn = "未记录的会话类型", er = "非法的群类型，请检查传入参数", tr = "不能加入 Private 类型的群组", nr = "AVChatRoom 类型的群组不能转让群主", rr = "不能把群主转让给自己",
    or = "不能解散 Private 类型的群组", ir = "加群失败，请检查传入参数或重试", sr = "AVChatRoom 类型的群不支持邀请群成员",
    ar = "非 AVChatRoom 类型的群组不允许匿名加群，请先登录后再加群", ur = "不能在 AVChatRoom 类型的群组踢人", cr = "你不是群主，只有群主才有权限操作",
    lr = "不能在 Private / AVChatRoom 类型的群中设置群成员身份", pr = "不合法的群成员身份，请检查传入参数", hr = "不能设置自己的群成员身份，请检查传入参数",
    fr = "不能将自己禁言，请检查传入参数", gr = "传入 deleteFriend 接口的参数无效", dr = "传入 updateMyProfile 接口的参数无效",
    mr = "updateMyProfile 无标配资料字段或自定义资料字段", yr = "传入 addToBlacklist 接口的参数无效", vr = "传入 removeFromBlacklist 接口的参数无效",
    _r = "不能拉黑自己", Mr = "网络层初始化错误，缺少 URL 参数", Cr = "打包错误，未定义的 serverName", Ir = "未定义的 packageConfig", Sr = "未连接到网络",
    Dr = "不规范的参数名称", kr = "意料外的通知条件", Tr = "_syncOffset 丢失", Er = "获取 longpolling id 失败",
    wr = "接口需要 SDK 处于 ready 状态后才能调用", Ar = ["jpg", "jpeg", "gif", "png"], Rr = ["mp4"], Lr = function () {
      function e(n) {
        r(this, e);
        var o = this._check(n);
        if (o instanceof lt) throw o;
        this.type = t.MSG_FILE, this._percent = 0;
        var i = this._getFileInfo(n);
        this.content = {
          downloadFlag: 2,
          fileUrl: n.url || "",
          uuid: n.uuid,
          fileName: i.name || "",
          fileSize: i.size || 0
        }
      }

      return i(e, [{
        key: "_getFileInfo", value: function (e) {
          if (e.fileName && e.fileSize) return {size: e.fileSize, name: e.fileName};
          if (E) return {};
          var t = e.file.files[0];
          return {size: t.size, name: t.name, type: t.type.slice(t.type.lastIndexOf("/") + 1).toLowerCase()}
        }
      }, {
        key: "updatePercent", value: function (e) {
          this._percent = e, this._percent > 1 && (this._percent = 1)
        }
      }, {
        key: "updateFileUrl", value: function (e) {
          this.content.fileUrl = e
        }
      }, {
        key: "_check", value: function (e) {
          if (e.size > 104857600) return new lt({code: Gt, message: "".concat(Wn, ": ").concat(104857600, " bytes")})
        }
      }, {
        key: "sendable", value: function () {
          return "" !== this.content.fileUrl && ("" !== this.content.fileName && 0 !== this.content.fileSize)
        }
      }]), e
    }(), Pr = function () {
      function e(n) {
        r(this, e), this.type = t.MSG_CUSTOM, this.content = {
          data: n.data || "",
          description: n.description || "",
          extension: n.extension || ""
        }
      }

      return i(e, [{
        key: "setData", value: function (e) {
          return this.content.data = e, this
        }
      }, {
        key: "setDescription", value: function (e) {
          return this.content.description = e, this
        }
      }, {
        key: "setExtension", value: function (e) {
          return this.content.extension = e, this
        }
      }, {
        key: "sendable", value: function () {
          return 0 !== this.content.data.length || 0 !== this.content.description.length || 0 !== this.content.extension.length
        }
      }]), e
    }(), br = function () {
      function e(n) {
        r(this, e), this.type = t.MSG_VIDEO, this._percent = 0, this.content = {
          remoteVideoUrl: n.remoteVideoUrl,
          videoFormat: n.videoFormat,
          videoSecond: parseInt(n.videoSecond, 10),
          videoSize: n.videoSize,
          videoUrl: n.videoUrl,
          videoDownloadFlag: 2,
          videoUUID: n.videoUUID,
          thumbUUID: n.thumbUUID,
          thumbFormat: n.thumbFormat,
          thumbWidth: n.thumbWidth,
          thumbHeight: n.thumbHeight,
          thumbSize: n.thumbSize,
          thumbDownloadFlag: 2,
          thumbUrl: n.thumbUrl
        }
      }

      return i(e, [{
        key: "updatePercent", value: function (e) {
          this._percent = e, this._percent > 1 && (this._percent = 1)
        }
      }, {
        key: "updateVideoUrl", value: function (e) {
          e && (this.content.remoteVideoUrl = e)
        }
      }, {
        key: "sendable", value: function () {
          return "" !== this.content.remoteVideoUrl
        }
      }]), e
    }(), Or = function e(n) {
      r(this, e), this.type = t.MSG_GEO, this.content = n
    }, Nr = {1: t.MSG_PRIORITY_HIGH, 2: t.MSG_PRIORITY_NORMAL, 3: t.MSG_PRIORITY_LOW, 4: t.MSG_PRIORITY_LOWEST},
    Gr = function () {
      function e(n) {
        r(this, e), this.ID = "", this.conversationID = n.conversationID || null, this.conversationType = n.conversationType || t.CONV_C2C, this.conversationSubType = n.conversationSubType, this.time = n.time || Math.ceil(Date.now() / 1e3), this.sequence = n.sequence || 0, this.clientSequence = n.clientSequence || n.sequence || 0, this.random = n.random || fe(), this.priority = this._computePriority(n.priority), this._elements = [], this.isPlaceMessage = n.isPlaceMessage || 0, this.isRevoked = 2 === n.isPlaceMessage || 8 === n.msgFlagBits, this.geo = {}, this.from = n.from || null, this.to = n.to || null, this.flow = "", this.isSystemMessage = n.isSystemMessage || !1, this.protocol = n.protocol || "JSON", this.isResend = !1, this.isRead = !1, this.status = n.status || Pe.SUCCESS, this.reInitialize(n.currentUser), this.extractGroupInfo(n.groupProfile || null)
      }

      return i(e, [{
        key: "getElements", value: function () {
          return this._elements
        }
      }, {
        key: "extractGroupInfo", value: function (e) {
          if (null !== e) {
            var t = e.messageFromAccountExtraInformation;
            this.nick = "", "string" == typeof e.fromAccountNick && (this.nick = e.fromAccountNick), this.avatar = "", "string" == typeof e.fromAccountHeadurl && (this.avatar = e.fromAccountHeadurl), this.nameCard = "", "object" === n(t) && t.hasOwnProperty("nameCard") && (this.nameCard = t.nameCard)
          }
        }
      }, {
        key: "_initProxy", value: function () {
          this.payload = this._elements[0].content, this.type = this._elements[0].type
        }
      }, {
        key: "reInitialize", value: function (e) {
          e && (this.status = this.from ? Pe.SUCCESS : Pe.UNSEND, !this.from && (this.from = e)), this._initFlow(e), this._initielizeSequence(e), this._concactConversationID(e), this.generateMessageID(e)
        }
      }, {
        key: "isSendable", value: function () {
          return 0 !== this._elements.length && ("function" != typeof this._elements[0].sendable ? (z.warn("".concat(this._elements[0].type, ' need "boolean : sendable()" method')), !1) : this._elements[0].sendable())
        }
      }, {
        key: "_initTo", value: function (e) {
          this.conversationType === t.CONV_GROUP && (this.to = e.groupID)
        }
      }, {
        key: "_initielizeSequence", value: function (e) {
          0 === this.clientSequence && e && (this.clientSequence = function (e) {
            if (!e) return z.error("autoincrementIndex(string: key) need key parameter"), !1;
            if (void 0 === ye[e]) {
              var t = new Date, n = "3".concat(t.getHours()).slice(-2), r = "0".concat(t.getMinutes()).slice(-2),
                o = "0".concat(t.getSeconds()).slice(-2);
              ye[e] = parseInt([n, r, o, "0001"].join("")), n = null, r = null, o = null, z.warn("utils.autoincrementIndex() create new sequence : ".concat(e, " = ").concat(ye[e]))
            }
            return ye[e]++
          }(e)), 0 === this.sequence && this.conversationType === t.CONV_C2C && (this.sequence = this.clientSequence)
        }
      }, {
        key: "generateMessageID", value: function (e) {
          var t = e === this.from ? 1 : 0, n = this.sequence > 0 ? this.sequence : this.clientSequence;
          this.ID = "".concat(this.conversationID, "-").concat(n, "-").concat(this.random, "-").concat(t)
        }
      }, {
        key: "_initFlow", value: function (e) {
          "" !== e && (e === this.from ? (this.flow = "out", this.isRead = !0) : this.flow = "in")
        }
      }, {
        key: "_concactConversationID", value: function (e) {
          var n = this.to, r = "", o = this.conversationType;
          o !== t.CONV_SYSTEM ? (r = o === t.CONV_C2C ? e === this.from ? n : this.from : this.to, this.conversationID = "".concat(o).concat(r)) : this.conversationID = t.CONV_SYSTEM
        }
      }, {
        key: "isElement", value: function (e) {
          return e instanceof Ge || e instanceof nt || e instanceof rt || e instanceof ot || e instanceof Lr || e instanceof br || e instanceof st || e instanceof ut || e instanceof Pr || e instanceof Or
        }
      }, {
        key: "setElement", value: function (e) {
          var n = this;
          if (this.isElement(e)) return this._elements = [e], void this._initProxy();
          var r = function (e) {
            switch (e.type) {
              case t.MSG_TEXT:
                n.setTextElement(e.content);
                break;
              case t.MSG_IMAGE:
                n.setImageElement(e.content);
                break;
              case t.MSG_AUDIO:
                n.setAudioElement(e.content);
                break;
              case t.MSG_FILE:
                n.setFileElement(e.content);
                break;
              case t.MSG_VIDEO:
                n.setVideoElement(e.content);
                break;
              case t.MSG_CUSTOM:
                n.setCustomElement(e.content);
                break;
              case t.MSG_GEO:
                n.setGEOElement(e.content);
                break;
              case t.MSG_GRP_TIP:
                n.setGroupTipElement(e.content);
                break;
              case t.MSG_GRP_SYS_NOTICE:
                n.setGroupSystemNoticeElement(e.content);
                break;
              case t.MSG_FACE:
                n.setFaceElement(e.content);
                break;
              default:
                z.warn(e.type, e.content, "no operation......")
            }
          };
          if (Array.isArray(e)) for (var o = 0; o < e.length; o++) r(e[o]); else r(e);
          this._initProxy()
        }
      }, {
        key: "setTextElement", value: function (e) {
          var t = "string" == typeof e ? e : e.text, n = new Ge({text: t});
          this._elements.push(n)
        }
      }, {
        key: "setImageElement", value: function (e) {
          var t = new nt(e);
          this._elements.push(t)
        }
      }, {
        key: "setAudioElement", value: function (e) {
          var t = new ot(e);
          this._elements.push(t)
        }
      }, {
        key: "setFileElement", value: function (e) {
          var t = new Lr(e);
          this._elements.push(t)
        }
      }, {
        key: "setVideoElement", value: function (e) {
          var t = new br(e);
          this._elements.push(t)
        }
      }, {
        key: "setGEOElement", value: function (e) {
          var t = new Or(e);
          this._elements.push(t)
        }
      }, {
        key: "setCustomElement", value: function (e) {
          var t = new Pr(e);
          this._elements.push(t)
        }
      }, {
        key: "setGroupTipElement", value: function (e) {
          var t = new st(e);
          this._elements.push(t)
        }
      }, {
        key: "setGroupSystemNoticeElement", value: function (e) {
          var t = new ut(e);
          this._elements.push(t)
        }
      }, {
        key: "setFaceElement", value: function (e) {
          var t = new rt(e);
          this._elements.push(t)
        }
      }, {
        key: "setIsRead", value: function (e) {
          this.isRead = e
        }
      }, {
        key: "_computePriority", value: function (e) {
          if (te(e)) return t.MSG_PRIORITY_NORMAL;
          if (J(e) && -1 !== Object.values(Nr).indexOf(e)) return e;
          if (X(e)) {
            var n = "" + e;
            if (-1 !== Object.keys(Nr).indexOf(n)) return Nr[n]
          }
          return t.MSG_PRIORITY_NORMAL
        }
      }, {
        key: "elements", get: function () {
          return z.warn("！！！Message 实例的 elements 属性即将废弃，请尽快修改。使用 type 和 payload 属性处理单条消息，兼容组合消息使用 _elements 属性！！！"), this._elements
        }
      }]), e
    }(), Ur = {
      login: {userID: {type: "String", required: !0}, userSig: {type: "String", required: !0}},
      addToBlacklist: {userIDList: {type: "Array", required: !0}},
      mutilParam: [{name: "paramName", type: "Number", required: !0}, {name: "paramName", type: "String", required: !0}],
      on: [{
        name: "eventName", type: "String", validator: function (e) {
          return "string" == typeof e && 0 !== e.length || (console.warn("on 接口的 eventName 参数必须是 String 类型，且不能为空。"), !1)
        }
      }, {
        name: "handler", type: "Function", validator: function (e) {
          return "function" != typeof e ? (console.warn("on 接口的 handler 参数必须是 Function 类型。"), !1) : ("" === e.name && console.warn("on 接口的 handler 参数推荐使用具名函数。具名函数可以使用 off 接口取消订阅，匿名函数无法取消订阅。"), !0)
        }
      }],
      once: [{
        name: "eventName", type: "String", validator: function (e) {
          return "string" == typeof e && 0 !== e.length || (console.warn("once 接口的 eventName 参数必须是 String 类型，且不能为空。"), !1)
        }
      }, {
        name: "handler", type: "Function", validator: function (e) {
          return "function" != typeof e ? (console.warn("once 接口的 handler 参数必须是 Function 类型。"), !1) : ("" === e.name && console.warn("once 接口的 handler 参数推荐使用具名函数。"), !0)
        }
      }],
      off: [{
        name: "eventName", type: "String", validator: function (e) {
          return "string" == typeof e && 0 !== e.length || (console.warn("off 接口的 eventName 参数必须是 String 类型，且不能为空。"), !1)
        }
      }, {
        name: "handler", type: "Function", validator: function (e) {
          return "function" != typeof e ? (console.warn("off 接口的 handler 参数必须是 Function 类型。"), !1) : ("" === e.name && console.warn("off 接口的 handler 参数为匿名函数，无法取消订阅。"), !0)
        }
      }],
      sendMessage: [{name: "message", type: "Object", required: !0}],
      getMessageList: {
        conversationID: {type: "String", required: !0},
        nextReqMessageID: {type: "String"},
        count: {
          type: "Number", validator: function (e) {
            return !(!te(e) && !/^[1-9][0-9]*$/.test(e)) || (console.warn("getMessageList 接口的 count 参数必须为正整数"), !1)
          }
        }
      },
      getConversationProfile: [{
        name: "conversationID", type: "String", required: !0, validator: function (e) {
          return !!e && (!!(J(n = e) && n.slice(0, 3) === t.CONV_C2C || function (e) {
            return J(e) && e.slice(0, 5) === t.CONV_GROUP
          }(e) || Se(e)) || (console.warn("非法的会话 ID:".concat(e, "。会话 ID 组成方式：\n      C2C + userID（单聊）\n      GROUP + groupID（群聊）\n      @TIM#SYSTEM（系统通知会话）")), !1));
          var n
        }
      }],
      deleteConversation: [{name: "conversationID", type: "String", required: !0}],
      getGroupList: {groupProfileFilter: {type: "Array"}},
      getGroupProfile: {
        groupID: {type: "String", required: !0},
        groupCustomFieldFilter: {type: "Array"},
        memberCustomFieldFilter: {type: "Array"}
      },
      getGroupProfileAdvance: {groupIDList: {type: "Array", required: !0}},
      createGroup: {name: {type: "String", required: !0}},
      joinGroup: {groupID: {type: "String", required: !0}, type: {type: "String"}, applyMessage: {type: "String"}},
      quitGroup: [{name: "groupID", type: "String", required: !0}],
      handleApplication: {
        message: {type: "Object", required: !0},
        handleAction: {type: "String", required: !0},
        handleMessage: {type: "String"}
      },
      changeGroupOwner: {groupID: {type: "String", required: !0}, newOwnerID: {type: "String", required: !0}},
      updateGroupProfile: {groupID: {type: "String", required: !0}},
      dismissGroup: [{name: "groupID", type: "String", required: !0}],
      searchGroupByID: [{name: "groupID", type: "String", required: !0}],
      getGroupMemberList: {groupID: {type: "String", required: !0}, offset: {type: "Number"}, count: {type: "Number"}},
      getGroupMemberProfile: {
        groupID: {type: "String", required: !0},
        userIDList: {type: "Array", required: !0},
        memberCustomFieldFilter: {type: "Array"}
      },
      addGroupMemeber: {groupID: {type: "String", required: !0}, userIDList: {type: "Array", required: !0}},
      setGroupMemberRole: {
        groupID: {type: "String", required: !0},
        userID: {type: "String", required: !0},
        role: {type: "String", required: !0}
      },
      setGroupMemberMuteTime: {
        groupID: {type: "String", required: !0},
        userID: {type: "String", required: !0},
        muteTime: {
          type: "Number", validator: function (e) {
            return e >= 0
          }
        }
      },
      setGroupMemberNameCard: {
        groupID: {type: "String", required: !0},
        userID: {type: "String"},
        nameCard: {
          type: "String", required: !0, validator: function (e) {
            return !0 !== /^\s+$/.test(e)
          }
        }
      },
      setMessageRemindType: {groupID: {type: "String", required: !0}, messageRemindType: {type: "String", required: !0}},
      setGroupMemberCustomField: {
        groupID: {type: "String", required: !0},
        userID: {type: "String"},
        memberCustomField: {type: "Array", required: !0}
      },
      deleteGroupMember: {groupID: {type: "String", required: !0}},
      createTextMessage: {
        to: {type: "String", required: !0},
        conversationType: {type: "String", required: !0},
        payload: {
          type: "Object", required: !0, validator: function (e) {
            return J(e.text) ? 0 !== e.text.length || (console.warn("createTextMessage 消息内容不能为空。请参考 https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/SDK.html#createTextMessage"), !1) : (console.warn("createTextMessage payload.text 类型必须为字符串。请参考 https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/SDK.html#createTextMessage"), !1)
          }
        }
      },
      createCustomMessage: {
        to: {type: "String", required: !0},
        conversationType: {type: "String", required: !0},
        payload: {type: "Object", required: !0}
      },
      createImageMessage: {
        to: {type: "String", required: !0},
        conversationType: {type: "String", required: !0},
        payload: {
          type: "Object", required: !0, validator: function (e) {
            if (te(e.file)) return console.warn("createImageMessage payload.file 不能为 undefined。请参考 https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/SDK.html#createImageMessage"), !1;
            return !0
          }, onProgress: {
            type: "Function", required: !1, validator: function (e) {
              return te(e) && console.warn("createImageMessage 没有 onProgress 回调，您将无法获取图片上传进度。请参考 https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/SDK.html#createImageMessage"), !0
            }
          }
        }
      },
      createAudioMessage: {
        to: {type: "String", required: !0},
        conversationType: {type: "String", required: !0},
        payload: {type: "Object", required: !0},
        onProgress: {
          type: "Function", required: !1, validator: function (e) {
            return te(e) && console.warn("createAudioMessage 没有 onProgress 回调，您将无法获取音频上传进度。请参考 https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/SDK.html#createAudioMessage"), !0
          }
        }
      },
      createVideoMessage: {
        to: {type: "String", required: !0},
        conversationType: {type: "String", required: !0},
        payload: {type: "Object", required: !0},
        onProgress: {
          type: "Function", required: !1, validator: function (e) {
            return te(e) && console.warn("createVideoMessage 没有 onProgress 回调，您将无法获取视频上传进度。请参考 https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/SDK.html#createVideoMessage"), !0
          }
        }
      },
      createFaceMessage: {
        to: {type: "String", required: !0},
        conversationType: {type: "String", required: !0},
        payload: {
          type: "Object", required: !0, validator: function (e) {
            return !!Z(e) && (X(e.index) ? !!J(e.data) || (console.warn("createFaceMessage payload.data 类型必须为 String！"), !1) : (console.warn("createFaceMessage payload.index 类型必须为 Number！"), !1))
          }
        }
      },
      createFileMessage: {
        to: {type: "String", required: !0},
        conversationType: {type: "String", required: !0},
        payload: {
          type: "Object", required: !0, validator: function (e) {
            if (te(e.file)) return console.warn("createFileMessage payload.file 不能为 undefined。请参考 https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/SDK.html#createFileMessage"), !1;
            if (T) {
              if (!(e.file instanceof HTMLInputElement || W(e.file))) return console.warn("createFileMessage payload.file 的类型必须是 HTMLInputElement 或 File。请参考 https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/SDK.html#createFileMessage"), !1;
              if (e.file instanceof HTMLInputElement && 0 === e.file.files.length) return console.warn("createFileMessage 您没有选择文件，无法发送。请参考 https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/SDK.html#createFileMessage"), !1
            }
            return !0
          }
        },
        onProgress: {
          type: "Function", required: !1, validator: function (e) {
            return te(e) && console.warn("createFileMessage 没有 onProgress 回调，您将无法获取文件上传进度。请参考 https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/SDK.html#createFileMessage"), !0
          }
        }
      },
      revokeMessage: [{
        name: "message", type: "Object", required: !0, validator: function (e) {
          return e.conversationType === t.CONV_SYSTEM ? (console.warn("revokeMessage 不能撤回系统会话消息，只能撤回单聊消息或群消息"), !1) : !0 !== e.isRevoked || (console.warn("revokeMessage 消息已经被撤回，请勿重复操作"), !1)
        }
      }],
      getUserProfile: {
        userIDList: {
          type: "Array", validator: function (e) {
            return ee(e) ? (0 === e.length && console.warn("getUserProfile userIDList 不能为空数组，请参考 https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/SDK.html#getUserProfile"), !0) : (console.warn("getUserProfile userIDList 必须为数组，请参考 https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/SDK.html#getUserProfile"), !1)
          }
        }
      },
      updateMyProfile: {
        profileCustomField: {
          type: "Array", validator: function (e) {
            return !!te(e) || (!!ee(e) || (console.warn("updateMyProfile profileCustomField 必须为数组，请参考 https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/SDK.html#updateMyProfile"), !1))
          }
        }
      }
    }, qr = {
      login: "login",
      logout: "logout",
      on: "on",
      once: "once",
      off: "off",
      setLogLevel: "setLogLevel",
      downloadLog: "downloadLog",
      registerPlugin: "registerPlugin",
      destroy: "destroy",
      createTextMessage: "createTextMessage",
      createImageMessage: "createImageMessage",
      createAudioMessage: "createAudioMessage",
      createVideoMessage: "createVideoMessage",
      createCustomMessage: "createCustomMessage",
      createFaceMessage: "createFaceMessage",
      createFileMessage: "createFileMessage",
      sendMessage: "sendMessage",
      resendMessage: "resendMessage",
      getMessageList: "getMessageList",
      setMessageRead: "setMessageRead",
      revokeMessage: "revokeMessage",
      getConversationList: "getConversationList",
      getConversationProfile: "getConversationProfile",
      deleteConversation: "deleteConversation",
      getGroupList: "getGroupList",
      getGroupProfile: "getGroupProfile",
      createGroup: "createGroup",
      joinGroup: "joinGroup",
      updateGroupProfile: "updateGroupProfile",
      quitGroup: "quitGroup",
      dismissGroup: "dismissGroup",
      changeGroupOwner: "changeGroupOwner",
      searchGroupByID: "searchGroupByID",
      setMessageRemindType: "setMessageRemindType",
      handleGroupApplication: "handleGroupApplication",
      getGroupMemberProfile: "getGroupMemberProfile",
      getGroupMemberList: "getGroupMemberList",
      addGroupMember: "addGroupMember",
      deleteGroupMember: "deleteGroupMember",
      setGroupMemberNameCard: "setGroupMemberNameCard",
      setGroupMemberMuteTime: "setGroupMemberMuteTime",
      setGroupMemberRole: "setGroupMemberRole",
      setGroupMemberCustomField: "setGroupMemberCustomField",
      getMyProfile: "getMyProfile",
      getUserProfile: "getUserProfile",
      updateMyProfile: "updateMyProfile",
      getBlacklist: "getBlacklist",
      addToBlacklist: "addToBlacklist",
      removeFromBlacklist: "removeFromBlacklist",
      getFriendList: "getFriendList"
    }, xr = "1.7.3", Fr = "537048168", Hr = "10", Br = "protobuf", Kr = "json", Vr = {
      HOST: {
        TYPE: 3,
        ACCESS_LAYER_TYPES: {SANDBOX: 1, TEST: 2, PRODUCTION: 3},
        CURRENT: {COMMON: "https://webim.tim.qq.com", PIC: "https://pic.tim.qq.com", COS: "https://yun.tim.qq.com"},
        PRODUCTION: {COMMON: "https://webim.tim.qq.com", PIC: "https://pic.tim.qq.com", COS: "https://yun.tim.qq.com"},
        SANDBOX: {COMMON: "https://events.tim.qq.com", PIC: "https://pic.tim.qq.com", COS: "https://yun.tim.qq.com"},
        TEST: {COMMON: "https://test.tim.qq.com", PIC: "https://pic.tim.qq.com", COS: "https://yun.tim.qq.com"},
        setCurrent: function () {
          var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 3;
          switch (e) {
            case this.ACCESS_LAYER_TYPES.SANDBOX:
              this.CURRENT = this.SANDBOX, this.TYPE = this.ACCESS_LAYER_TYPES.SANDBOX;
              break;
            case this.ACCESS_LAYER_TYPES.TEST:
              this.CURRENT = this.TEST, this.TYPE = this.ACCESS_LAYER_TYPES.TEST;
              break;
            default:
              this.CURRENT = this.PRODUCTION, this.TYPE = this.ACCESS_LAYER_TYPES.PRODUCTION
          }
        }
      },
      NAME: {
        OPEN_IM: "openim",
        GROUP: "group_open_http_svc",
        FRIEND: "sns",
        PROFILE: "profile",
        RECENT_CONTACT: "recentcontact",
        PIC: "openpic",
        BIG_GROUP_NO_AUTH: "group_open_http_noauth_svc",
        BIG_GROUP_LONG_POLLING_NO_AUTH: "group_open_long_polling_http_noauth_svc",
        IM_OPEN_STAT: "imopenstat",
        WEB_IM: "webim",
        IM_COS_SIGN: "im_cos_sign_svr"
      },
      CMD: {
        ACCESS_LAYER: "accesslayer",
        LOGIN: "login",
        LOGOUT_LONG_POLL: "longpollinglogout",
        LOGOUT_ALL: "logout",
        PORTRAIT_GET: "portrait_get_all",
        PORTRAIT_SET: "portrait_set",
        GET_LONG_POLL_ID: "getlongpollingid",
        LONG_POLL: "longpolling",
        AVCHATROOM_LONG_POLL: "get_msg",
        FRIEND_ADD: "friend_add",
        FRIEND_GET_ALL: "friend_get_all",
        FRIEND_DELETE: "friend_delete",
        RESPONSE_PENDENCY: "friend_response",
        GET_PENDENCY: "pendency_get",
        DELETE_PENDENCY: "pendency_delete",
        GET_GROUP_PENDENCY: "get_pendency",
        GET_BLACKLIST: "black_list_get",
        ADD_BLACKLIST: "black_list_add",
        DELETE_BLACKLIST: "black_list_delete",
        CREATE_GROUP: "create_group",
        GET_JOINED_GROUPS: "get_joined_group_list",
        SEND_MESSAGE: "sendmsg",
        REVOKE_C2C_MESSAGE: "msgwithdraw",
        SEND_GROUP_MESSAGE: "send_group_msg",
        REVOKE_GROUP_MESSAGE: "group_msg_recall",
        GET_GROUP_INFO: "get_group_info",
        GET_GROUP_MEMBER_INFO: "get_specified_group_member_info",
        GET_GROUP_MEMBER_LIST: "get_group_member_info",
        QUIT_GROUP: "quit_group",
        CHANGE_GROUP_OWNER: "change_group_owner",
        DESTROY_GROUP: "destroy_group",
        ADD_GROUP_MEMBER: "add_group_member",
        DELETE_GROUP_MEMBER: "delete_group_member",
        SEARCH_GROUP_BY_ID: "get_group_public_info",
        APPLY_JOIN_GROUP: "apply_join_group",
        HANDLE_APPLY_JOIN_GROUP: "handle_apply_join_group",
        MODIFY_GROUP_INFO: "modify_group_base_info",
        MODIFY_GROUP_MEMBER_INFO: "modify_group_member_info",
        DELETE_GROUP_SYSTEM_MESSAGE: "deletemsg",
        GET_CONVERSATION_LIST: "get",
        PAGING_GET_CONVERSATION_LIST: "page_get",
        DELETE_CONVERSATION: "delete",
        GET_MESSAGES: "getmsg",
        GET_C2C_ROAM_MESSAGES: "getroammsg",
        GET_GROUP_ROAM_MESSAGES: "group_msg_get",
        SET_C2C_MESSAGE_READ: "msgreaded",
        SET_GROUP_MESSAGE_READ: "msg_read_report",
        FILE_READ_AND_WRITE_AUTHKEY: "authkey",
        FILE_UPLOAD: "pic_up",
        COS_SIGN: "cos",
        TIM_WEB_REPORT: "tim_web_report",
        BIG_DATA_HALLWAY_AUTH_KEY: "authkey"
      },
      CHANNEL: {SOCKET: 1, XHR: 2, AUTO: 0},
      NAME_VERSION: {
        openim: "v4",
        group_open_http_svc: "v4",
        sns: "v4",
        profile: "v4",
        recentcontact: "v4",
        openpic: "v4",
        group_open_http_noauth_svc: "v1",
        group_open_long_polling_http_noauth_svc: "v1",
        imopenstat: "v4",
        im_cos_sign_svr: "v4",
        webim: "v4"
      }
    };
  Vr.HOST.setCurrent(Vr.HOST.ACCESS_LAYER_TYPES.PRODUCTION);
  var jr = {
      request: {
        toAccount: "To_Account",
        fromAccount: "From_Account",
        to: "To_Account",
        from: "From_Account",
        groupID: "GroupId",
        avatar: "FaceUrl"
      }, response: {
        GroupId: "groupID",
        Member_Account: "userID",
        MsgList: "messageList",
        SyncFlag: "syncFlag",
        To_Account: "to",
        From_Account: "from",
        MsgSeq: "sequence",
        MsgRandom: "random",
        MsgTimeStamp: "time",
        MsgContent: "content",
        MsgBody: "elements",
        GroupWithdrawInfoArray: "revokedInfos",
        WithdrawC2cMsgNotify: "c2cMessageRevokedNotify",
        C2cWithdrawInfoArray: "revokedInfos",
        MsgRand: "random",
        MsgType: "type",
        MsgShow: "messageShow",
        NextMsgSeq: "nextMessageSeq",
        FaceUrl: "avatar",
        ProfileDataMod: "profileModify",
        Profile_Account: "userID",
        ValueBytes: "value",
        ValueNum: "value",
        NoticeSeq: "noticeSequence",
        NotifySeq: "notifySequence",
        MsgFrom_AccountExtraInfo: "messageFromAccountExtraInformation",
        Operator_Account: "operatorID",
        OpType: "operationType",
        ReportType: "operationType",
        UserId: "userID",
        User_Account: "userID",
        List_Account: "userIDList",
        MsgOperatorMemberExtraInfo: "operatorInfo",
        MsgMemberExtraInfo: "memberInfoList",
        ImageUrl: "avatar",
        NickName: "nick",
        MsgGroupNewInfo: "newGroupProfile",
        Owner_Account: "ownerID",
        GroupName: "name",
        GroupFaceUrl: "avatar",
        GroupIntroduction: "introduction",
        GroupNotification: "notification",
        GroupApplyJoinOption: "joinOption",
        MsgKey: "messageKey",
        GroupInfo: "groupProfile",
        ShutupTime: "muteTime",
        Desc: "description",
        Ext: "extension"
      }, ignoreKeyWord: ["C2C", "ID", "USP"]
    }, $r = "_contextWasUpdated", Yr = "_contextWasReset", zr = "_a2KeyAndTinyIDUpdated", Wr = "_noticeIsSynchronizing",
    Xr = "_noticeIsSynchronized", Jr = "_messageSent", Qr = "_sendC2CMessageSuccess", Zr = "_syncMessageProcessing",
    eo = "_syncMessageFinished", to = "_receiveInstantMessage", no = "_sendGroupMessageSuccess",
    ro = "_receiveGroupInstantMessage", oo = "_receveGroupSystemNotice", io = "_messageRevoked", so = "_longPollStart",
    ao = "_longPollInArrived", uo = "_longPollNotArrived", co = "_longPollError", lo = "_longPollSoonReconnect",
    po = "_longPollLongReconnect", ho = "_longpollChannelDisconnect", fo = "_longPollStopped",
    go = "_longPollKickedOut", mo = "_longPollMitipuleDeviceKickedOut", yo = "_longPollGetNewC2CNotice",
    vo = "_longPollGetNewGroupMessages", _o = "_longPollGetNewGroupTips", Mo = "_longPollGetNewGroupNotice",
    Co = "_longPollGetNewFriendMessages", Io = "_longPollProfileModified", So = "_longPollNoticeReceiveSystemOrders",
    Do = "_longpollRestart", ko = " _longpollGroupMessageRevoked", To = "_longpollC2CMessageRevoked",
    Eo = "_onGroupListUpdated", wo = "_login", Ao = "_loginSuccess", Ro = "_signLogoutExcuting", Lo = "_logoutSuccess",
    Po = "_a2keyExpired", bo = "_errorHasBeenDetected", Oo = "_onConversationListUpdated",
    No = "_onConversationListProfileUpdated", Go = "_conversationDeleted", Uo = "onProfileUpdated",
    qo = "joinAVChatRoomSuccess", xo = "_sdkStateReady";

  function Fo(e, t) {
    if ("string" != typeof e && !Array.isArray(e)) throw new TypeError("Expected the input to be `string | string[]`");
    t = Object.assign({pascalCase: !1}, t);
    var n;
    return 0 === (e = Array.isArray(e) ? e.map((function (e) {
      return e.trim()
    })).filter((function (e) {
      return e.length
    })).join("-") : e.trim()).length ? "" : 1 === e.length ? t.pascalCase ? e.toUpperCase() : e.toLowerCase() : (e !== e.toLowerCase() && (e = Ho(e)), e = e.replace(/^[_.\- ]+/, "").toLowerCase().replace(/[_.\- ]+(\w|$)/g, (function (e, t) {
      return t.toUpperCase()
    })).replace(/\d+(\w|$)/g, (function (e) {
      return e.toUpperCase()
    })), n = e, t.pascalCase ? n.charAt(0).toUpperCase() + n.slice(1) : n)
  }

  var Ho = function (e) {
    for (var t = !1, n = !1, r = !1, o = 0; o < e.length; o++) {
      var i = e[o];
      t && /[a-zA-Z]/.test(i) && i.toUpperCase() === i ? (e = e.slice(0, o) + "-" + e.slice(o), t = !1, r = n, n = !0, o++) : n && r && /[a-zA-Z]/.test(i) && i.toLowerCase() === i ? (e = e.slice(0, o - 1) + "-" + e.slice(o - 1), r = n, n = !1, t = !0) : (t = i.toLowerCase() === i && i.toUpperCase() !== i, r = n, n = i.toUpperCase() === i && i.toLowerCase() !== i)
    }
    return e
  };

  function Bo(e, t, n) {
    var r = [], o = 0, i = function e(t, n) {
      if (++o > 10) return o--, t;
      if (ee(t)) {
        var i = t.map((function (t) {
          return Q(t) ? e(t, n) : t
        }));
        return o--, i
      }
      if (Q(t)) {
        var s = (a = t, u = function (e, t) {
          if (!se(t)) return !1;
          if ((s = t) !== Fo(s)) {
            for (var o = !0, i = 0; i < jr.ignoreKeyWord.length; i++) if (t.includes(jr.ignoreKeyWord[i])) {
              o = !1;
              break
            }
            o && r.push(t)
          }
          var s;
          return te(n[t]) ? function (e) {
            return e[0].toUpperCase() + Fo(e).slice(1)
          }(t) : n[t]
        }, c = Object.create(null), Object.keys(a).forEach((function (e) {
          var t = u(a[e], e);
          t && (c[t] = a[e])
        })), c);
        return s = De(s, (function (t, r) {
          return ee(t) || Q(t) ? e(t, n) : t
        })), o--, s
      }
      var a, u, c
    }(e, t = u({}, jr.request, {}, t));
    return r.length > 0 && n.innerEmitter.emit(bo, {code: gn, message: Dr}), i
  }

  function Ko(e, t) {
    if (t = u({}, jr.response, {}, t), ee(e)) return e.map((function (e) {
      return Q(e) ? Ko(e, t) : e
    }));
    if (Q(e)) {
      var n = (r = e, o = function (e, n) {
        return te(t[n]) ? Fo(n) : t[n]
      }, i = {}, Object.keys(r).forEach((function (e) {
        i[o(r[e], e)] = r[e]
      })), i);
      return n = De(n, (function (e) {
        return ee(e) || Q(e) ? Ko(e, t) : e
      }))
    }
    var r, o, i
  }

  var Vo = function () {
    function e(t, n) {
      var o = this;
      if (r(this, e), void 0 === n) throw new lt({code: dt, message: wn});
      this.tim = n, this.method = t.method || "POST", this._initializeServerMap(), this._initializeURL(t), this._initializeRequestData(t), this.callback = function (e) {
        return Ko(e = t.decode(e), o._getResponseMap(t))
      }
    }

    return i(e, [{
      key: "_initializeServerMap", value: function () {
        this._serverMap = Object.create(null);
        var e = "";
        for (var t in Vr.NAME) if (Object.prototype.hasOwnProperty.call(Vr.NAME, t)) switch (e = Vr.NAME[t]) {
          case Vr.NAME.PIC:
            this._serverMap[e] = Vr.HOST.CURRENT.PIC;
            break;
          case Vr.NAME.IM_COS_SIGN:
            this._serverMap[e] = Vr.HOST.CURRENT.COS;
            break;
          default:
            this._serverMap[e] = Vr.HOST.CURRENT.COMMON
        }
      }
    }, {
      key: "_getHost", value: function (e) {
        if (void 0 !== this._serverMap[e]) return this._serverMap[e];
        throw new lt({code: pn, message: Cr})
      }
    }, {
      key: "_initializeURL", value: function (e) {
        var t = e.serverName, n = e.cmd, r = this._getHost(t),
          o = "".concat(r, "/").concat(Vr.NAME_VERSION[t], "/").concat(t, "/").concat(n);
        o += "?".concat(this._getQueryString(e.queryString)), this.url = o
      }
    }, {
      key: "getUrl", value: function () {
        return this.url.replace(/&reqtime=(\d+)/, "&reqtime=".concat(Math.ceil(+new Date / 1e3)))
      }
    }, {
      key: "_initializeRequestData", value: function (e) {
        var t, n = e.requestData;
        t = this._requestDataCleaner(n), this.requestData = e.encode(t)
      }
    }, {
      key: "_requestDataCleaner", value: function (e) {
        var t = Array.isArray(e) ? [] : Object.create(null);
        for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && se(r) && null !== e[r] && ("object" !== n(e[r]) ? t[r] = e[r] : t[r] = this._requestDataCleaner.bind(this)(e[r]));
        return t
      }
    }, {
      key: "_getQueryString", value: function (e) {
        var t = [];
        for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && ("function" != typeof e[n] ? t.push("".concat(n, "=").concat(e[n])) : t.push("".concat(n, "=").concat(e[n]())));
        return t.join("&")
      }
    }, {
      key: "_getResponseMap", value: function (e) {
        if (e.keyMaps && e.keyMaps.response && Object.keys(e.keyMaps.response).length > 0) return e.keyMaps.response
      }
    }]), e
  }();

  function jo(e) {
    this.mixin(e)
  }

  jo.mixin = function (e) {
    var t = e.prototype || e;
    t._isReady = !1, t.ready = function (e) {
      var t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
      if (e) return this._isReady ? void (t ? e.call(this) : setTimeout(e, 1)) : (this._readyQueue = this._readyQueue || [], void this._readyQueue.push(e))
    }, t.triggerReady = function () {
      var e = this;
      this._isReady = !0, setTimeout((function () {
        var t = e._readyQueue;
        e._readyQueue = [], t && t.length > 0 && t.forEach((function (e) {
          e.call(this)
        }), e)
      }), 1)
    }, t.resetReady = function () {
      this._isReady = !1, this._readyQueue = []
    }, t.isReady = function () {
      return this._isReady
    }
  };
  var $o = function () {
      function e(t) {
        if (r(this, e), !1 == !!t) throw new lt({code: dt, message: wn});
        jo.mixin(this), this.tim = t, this.innerEmitter = t.innerEmitter, this.connectionController = t.connectionController, this.packageConfig = t.packageConfig, this.packageConfig.update(t)
      }

      return i(e, [{
        key: "isLoggedIn", value: function () {
          return this.tim.context.login === Le.IS_LOGIN
        }
      }, {
        key: "createPackage", value: function (e) {
          var t = this.packageConfig.get(e);
          return !!t && new Vo(t, this.tim)
        }
      }, {
        key: "reset", value: function () {
          z.warn(["method: IMController.reset() method must be implemented"].join())
        }
      }, {
        key: "probeNetwork", value: function () {
          return this.tim.netMonitor.probe()
        }
      }, {
        key: "getNetworkType", value: function () {
          return this.tim.netMonitor.getNetworkType()
        }
      }, {
        key: "destroy", value: function () {
          z.warn("destory")
        }
      }, {
        key: "getPlatform", value: function () {
          var e = "web";
          return q ? e = "wechat" : E && (e = "wxmp"), e
        }
      }]), e
    }(), Yo = function () {
      function e(t, n) {
        r(this, e), this.data = t, this.tim = n, this.defaultData = {}, Object.assign(this.defaultData, t), this.initGetterAndSetter()
      }

      return i(e, [{
        key: "initGetterAndSetter", value: function () {
          var e = this, t = this.tim, n = function (n, r) {
            Object.defineProperty(e, n, {
              enumerable: !0, configurable: !0, get: function () {
                return e.data[n]
              }, set: function (r) {
                e.data[n] = r, e.onChange.bind(e)(t.context, n, r)
              }
            })
          };
          for (var r in e.data) Object.prototype.hasOwnProperty.call(e.data, r) && n(r, e.data[r])
        }
      }, {
        key: "onChange", value: function (e, t, n) {
          this.tim.innerEmitter.emit($r, {data: {context: e, key: t, value: n}})
        }
      }, {
        key: "reset", value: function () {
          for (var e in this.data) Object.prototype.hasOwnProperty.call(this.data, e) && (this.data[e] = this.defaultData.hasOwnProperty(e) ? this.defaultData[e] : null);
          this.tim.innerEmitter.emit(Yr, {data: this.tim.context})
        }
      }]), e
    }(), zo = function (e) {
      function t(e) {
        var n;
        return r(this, t), (n = m(this, l(t).call(this, e)))._initContext(), n._initListener(), n
      }

      return c(t, e), i(t, [{
        key: "reset", value: function () {
          this.tim.context.reset()
        }
      }, {
        key: "_initListener", value: function () {
          this.tim.innerEmitter.on(Ao, this._updateA2KeyAndTinyID, this)
        }
      }, {
        key: "_updateA2KeyAndTinyID", value: function (e) {
          var t = e.data, n = t.a2Key, r = t.tinyID;
          this.set("a2Key", n), this.set("tinyID", r), this.tim.innerEmitter.emit(zr, {data: {context: this.tim.context}}), this.triggerReady()
        }
      }, {
        key: "get", value: function (e) {
          return this.tim.context[e]
        }
      }, {
        key: "set", value: function (e, t) {
          this.tim.context[e] = t
        }
      }, {
        key: "_initContext", value: function () {
          var e = this.tim.loginInfo;
          this.tim.context = new Yo({
            login: Le.IS_NOT_LOGIN,
            SDKAppID: e.SDKAppID,
            appIDAt3rd: null,
            accountType: e.accountType,
            identifier: e.identifier,
            tinyID: null,
            identifierNick: e.identifierNick,
            userSig: e.userSig,
            a2Key: null,
            contentType: "json",
            apn: 1
          }, this.tim), this.tim.innerEmitter.on($r, this._onContextMemberChange.bind(this))
        }
      }, {
        key: "_onContextMemberChange", value: function (e) {
          var t = e.data, n = t.key, r = t.value;
          switch (n) {
            case"tinyID":
              r.length <= 0 ? this.tim.context.login = Le.IS_NOT_LOGIN : this.tim.context.login = null !== this.tim.context.a2Key ? Le.IS_LOGIN : Le.IS_NOT_LOGIN;
              break;
            case"a2Key":
              r.length <= 0 ? this.tim.context.login = Le.IS_NOT_LOGIN : this.tim.context.login = null !== this.tim.context.tinyID ? Le.IS_LOGIN : Le.IS_NOT_LOGIN
          }
        }
      }]), t
    }($o), Wo = function e(t) {
      r(this, e), this.code = 0, this.data = t || {}
    }, Xo = null, Jo = function (e) {
      Xo = e
    }, Qo = function (e) {
      return e instanceof Wo ? (z.warn("IMPromise.resolve 此函数会自动用options创建IMResponse实例，调用侧不需创建，建议修改！"), Promise.resolve(e)) : Promise.resolve(new Wo(e))
    }, Zo = function (t) {
      var n = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
      if (t instanceof lt) return n && null !== Xo && Xo.emit(e.ERROR, t), Promise.reject(t);
      if (t instanceof Error) {
        var r = new lt({code: yn, message: t.message});
        return n && null !== Xo && Xo.emit(e.ERROR, r), Promise.reject(r)
      }
      if (te(t) || te(t.code) || te(t.message)) z.error("IMPromise.reject 必须指定code(错误码)和message(错误信息)!!!"); else {
        if (X(t.code) && J(t.message)) {
          var o = new lt(t);
          return n && null !== Xo && Xo.emit(e.ERROR, o), Promise.reject(o)
        }
        z.error("IMPromise.reject code(错误码)必须为数字，message(错误信息)必须为字符串!!!")
      }
    }, ei = "sdkReady", ti = "login", ni = "longpolling", ri = "longpollingAV", oi = "sendMessage",
    ii = "initConversationList", si = "initGroupList", ai = "upload", ui = function () {
      function e() {
        r(this, e), this.SDKAppID = "", this.version = "", this.tinyID = "", this.userID = "", this.platform = "", this.method = "", this.time = "", this.startts = 0, this.endts = 0, this.timespan = 0, this.codeint = 0, this.message = "", this.text = "", this.msgType = "", this.networkType = "", this.platform = "", this._sentFlag = !1
      }

      return i(e, [{
        key: "setCommonInfo", value: function (e, t, n, r, o) {
          this.SDKAppID = "".concat(e), this.version = "".concat(t), this.tinyID = n, this.userID = r, this.platform = o, this.time = pe(), this.startts && this.endts && !this.timespan && (this.timespan = Math.abs(this.endts - this.startts))
        }
      }, {
        key: "setMethod", value: function (e) {
          return this.method = e, this
        }
      }, {
        key: "setStart", value: function () {
          this.startts = Date.now()
        }
      }, {
        key: "setEnd", value: function () {
          var e = this, t = arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
          this._sentFlag || (this.endts = Date.now(), t ? (this._sentFlag = !0, this._eventStatController.pushIn(this)) : setTimeout((function () {
            e._sentFlag = !0, e._eventStatController.pushIn(e)
          }), 0))
        }
      }, {
        key: "setError", value: function (e, t, n) {
          return e instanceof Error ? this._sentFlag ? this : (this.setNetworkType(n), t ? (e.code && this.setCode(e.code), e.message && this.setMessage(e.message)) : (this.setCode(fn), this.setMessage(Sr)), this) : (z.warn("SSOLogData.setError value not instanceof Error, please check!"), this)
        }
      }, {
        key: "setCode", value: function (e) {
          return te(e) || this._sentFlag ? this : (X(e) ? this.codeint = e : z.warn("SSOLogData.setCode value not a number, please check!"), this)
        }
      }, {
        key: "setMessage", value: function (e) {
          return te(e) || this._sentFlag ? this : J(e) ? (this.message = e, this) : this
        }
      }, {
        key: "setText", value: function (e) {
          return X(e) ? this.text = e.toString() : J(e) && (this.text = e), this
        }
      }, {
        key: "setMessageType", value: function (e) {
          return this.msgType = e, this
        }
      }, {
        key: "setNetworkType", value: function (e) {
          return this.networkType = e, this
        }
      }], [{
        key: "bindController", value: function (t) {
          e.prototype._eventStatController = t
        }
      }]), e
    }(), ci = "sdkConstruct", li = "sdkReady", pi = "accessLayer", hi = "login", fi = "upload", gi = "sendMessage",
    di = "getC2CRoamingMessages", mi = "getGroupRoamingMessages", yi = "revokeMessage", vi = "setC2CMessageRead",
    _i = "setGroupMessageRead", Mi = "getConversationList", Ci = "getConversationListInStorage",
    Ii = "syncConversationList", Si = "createGroup", Di = "applyJoinGroup", ki = "quitGroup", Ti = "changeGroupOwner",
    Ei = "dismissGroup", wi = "updateGroupProfile", Ai = "getGroupList", Ri = "getGroupListInStorage",
    Li = "setGroupMemberMuteTime", Pi = "setGroupMemberNameCard", bi = "setGroupMemberRole",
    Oi = "setGroupMemberCustomField", Ni = "longPollingError", Gi = "longPollingAVError", Ui = "getUserProfile",
    qi = "getBlacklist", xi = "mpHideToShow", Fi = function (n) {
      function o(e) {
        var t;
        return r(this, o), (t = m(this, l(o).call(this, e)))._initializeListener(), t
      }

      return c(o, n), i(o, [{
        key: "login", value: function (e) {
          if (this._isLogin()) {
            var t = "您已经登录账号".concat(e.identifier, "！如需切换账号登录，请先调用 logout 接口登出，再调用 login 接口登录。");
            return z.warn(t), Qo(new Wo({actionStatus: "OK", errorCode: 0, errorInfo: t}))
          }
          z.log("SignController.login userID=", e.identifier), z.time(ti);
          var n = this._checkLoginInfo(e);
          return Te(n) ? (this.tim.context.identifier = e.identifier, this.tim.context.userSig = e.userSig, this.tim.context.SDKAppID = e.SDKAppID, this.tim.context.accountType = e.accountType, this.tim.context.identifier && this.tim.context.userSig ? (this.tim.innerEmitter.emit(wo), this._accessLayer()) : void 0) : Zo(n)
        }
      }, {
        key: "_isLogin", value: function () {
          return !!this.tim.context.a2Key
        }
      }, {
        key: "_isLoginCurrentUser", value: function (e) {
          return this.tim.context.identifier === e
        }
      }, {
        key: "_initializeListener", value: function () {
          this.innerEmitter.on(go, this._onKickedOut, this), this.innerEmitter.on(mo, this._onMultipleDeviceKickedOut, this), this.innerEmitter.on(Po, this._onUserSigExpired, this)
        }
      }, {
        key: "_accessLayer", value: function () {
          var e = this, t = new ui;
          t.setMethod(pi).setStart(), z.log("SignController._accessLayer.");
          var n = this.createPackage({name: "accessLayer", action: "query"});
          return this.tim.connectionController.request(n).then((function (n) {
            return t.setCode(0).setNetworkType(e.getNetworkType()).setText(n.data.webImAccessLayer).setEnd(), z.log("SignController._accessLayer ok. webImAccessLayer=", n.data.webImAccessLayer), 1 === n.data.webImAccessLayer && Vr.HOST.setCurrent(n.data.webImAccessLayer), e._login()
          })).catch((function (n) {
            return e.probeNetwork().then((function (r, o) {
              t.setError(n, r, o).setEnd(!0), e.tim.eventStatController.reportAtOnce()
            })), z.error("SignController._accessLayer error:", n), Zo(n)
          }))
        }
      }, {
        key: "_login", value: function () {
          var e = this, t = new ui;
          t.setMethod(hi).setStart();
          var n = this.createPackage({name: "login", action: "query"});
          return this.connectionController.request(n).then((function (n) {
            var r = null;
            if (!n.data.tinyID) throw r = new lt({
              code: mt,
              message: An
            }), t.setError(r, !0, e.getNetworkType()).setEnd(), r;
            if (!n.data.a2Key) throw r = new lt({
              code: yt,
              message: Rn
            }), t.setError(r, !0, e.getNetworkType()).setEnd(), r;
            return t.setCode(0).setNetworkType(e.getNetworkType()).setText("".concat(e.tim.loginInfo.identifier)).setEnd(), z.log("SignController.login ok. userID=".concat(e.tim.loginInfo.identifier, " loginCost=").concat(z.timeEnd(ti), "ms")), e.tim.innerEmitter.emit(Ao, {
              data: {
                a2Key: n.data.a2Key,
                tinyID: n.data.tinyID
              }
            }), Qo(n.data)
          })).catch((function (n) {
            return e.probeNetwork().then((function (e, r) {
              t.setError(n, e, r).setEnd(!0)
            })), z.error("SignController.login error:", n), Zo(n)
          }))
        }
      }, {
        key: "logout", value: function () {
          return z.info("SignController.logout"), this.tim.innerEmitter.emit(Ro), this._logout(Je).then(this._emitLogoutSuccess.bind(this)).catch(this._emitLogoutSuccess.bind(this))
        }
      }, {
        key: "_logout", value: function (e) {
          var t = this.tim.notificationController, n = e === Xe ? "logout" : "longPollLogout",
            r = e === Xe ? {name: n, action: "query"} : {
              name: n,
              action: "query",
              param: {longPollID: t.getLongPollID()}
            }, o = this.createPackage(r);
          return this.connectionController.request(o).catch((function (e) {
            return z.error("SignController._logout error:", e), Zo(e)
          }))
        }
      }, {
        key: "_checkLoginInfo", value: function (e) {
          var t = 0, n = "";
          return null === e.SDKAppID ? (t = pt, n = Dn) : null === e.accountType ? (t = ht, n = kn) : null === e.identifier ? (t = ft, n = Tn) : null === e.userSig && (t = gt, n = En), Te(t) || Te(n) ? {} : {
            code: t,
            message: n
          }
        }
      }, {
        key: "_emitLogoutSuccess", value: function () {
          return this.tim.innerEmitter.emit(Lo), Qo({})
        }
      }, {
        key: "_onKickedOut", value: function () {
          var n = this;
          z.warn("SignController._onKickedOut kicked out. userID=".concat(this.tim.loginInfo.identifier)), this.tim.logout().then((function () {
            n.tim.outerEmitter.emit(e.KICKED_OUT, {type: t.KICKED_OUT_MULT_ACCOUNT})
          }))
        }
      }, {
        key: "_onMultipleDeviceKickedOut", value: function () {
          var n = this;
          z.warn("SignController._onMultipleDeviceKickedOut kicked out. userID=".concat(this.tim.loginInfo.identifier)), this.tim.logout().then((function () {
            n.tim.outerEmitter.emit(e.KICKED_OUT, {type: t.KICKED_OUT_MULT_DEVICE})
          }))
        }
      }, {
        key: "_onUserSigExpired", value: function () {
          z.warn("SignController._onUserSigExpired: userSig 签名过期被踢下线"), this.tim.outerEmitter.emit(e.KICKED_OUT, {type: t.KICKED_OUT_USERSIG_EXPIRED}), this.tim.resetSDK()
        }
      }, {
        key: "reset", value: function () {
          z.info("SignController.reset")
        }
      }]), o
    }($o), Hi = function (e, t) {
      return function () {
        for (var n = new Array(arguments.length), r = 0; r < n.length; r++) n[r] = arguments[r];
        return e.apply(t, n)
      }
    }, Bi = Object.prototype.toString;

  function Ki(e) {
    return "[object Array]" === Bi.call(e)
  }

  function Vi(e) {
    return void 0 === e
  }

  function ji(e) {
    return null !== e && "object" == typeof e
  }

  function $i(e) {
    return "[object Function]" === Bi.call(e)
  }

  function Yi(e, t) {
    if (null != e) if ("object" != typeof e && (e = [e]), Ki(e)) for (var n = 0, r = e.length; n < r; n++) t.call(null, e[n], n, e); else for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && t.call(null, e[o], o, e)
  }

  var zi = {
    isArray: Ki, isArrayBuffer: function (e) {
      return "[object ArrayBuffer]" === Bi.call(e)
    }, isBuffer: function (e) {
      return null !== e && !Vi(e) && null !== e.constructor && !Vi(e.constructor) && "function" == typeof e.constructor.isBuffer && e.constructor.isBuffer(e)
    }, isFormData: function (e) {
      return "undefined" != typeof FormData && e instanceof FormData
    }, isArrayBufferView: function (e) {
      return "undefined" != typeof ArrayBuffer && ArrayBuffer.isView ? ArrayBuffer.isView(e) : e && e.buffer && e.buffer instanceof ArrayBuffer
    }, isString: function (e) {
      return "string" == typeof e
    }, isNumber: function (e) {
      return "number" == typeof e
    }, isObject: ji, isUndefined: Vi, isDate: function (e) {
      return "[object Date]" === Bi.call(e)
    }, isFile: function (e) {
      return "[object File]" === Bi.call(e)
    }, isBlob: function (e) {
      return "[object Blob]" === Bi.call(e)
    }, isFunction: $i, isStream: function (e) {
      return ji(e) && $i(e.pipe)
    }, isURLSearchParams: function (e) {
      return "undefined" != typeof URLSearchParams && e instanceof URLSearchParams
    }, isStandardBrowserEnv: function () {
      return ("undefined" == typeof navigator || "ReactNative" !== navigator.product && "NativeScript" !== navigator.product && "NS" !== navigator.product) && ("undefined" != typeof window && "undefined" != typeof document)
    }, forEach: Yi, merge: function e() {
      var t = {};

      function n(n, r) {
        "object" == typeof t[r] && "object" == typeof n ? t[r] = e(t[r], n) : t[r] = n
      }

      for (var r = 0, o = arguments.length; r < o; r++) Yi(arguments[r], n);
      return t
    }, deepMerge: function e() {
      var t = {};

      function n(n, r) {
        "object" == typeof t[r] && "object" == typeof n ? t[r] = e(t[r], n) : t[r] = "object" == typeof n ? e({}, n) : n
      }

      for (var r = 0, o = arguments.length; r < o; r++) Yi(arguments[r], n);
      return t
    }, extend: function (e, t, n) {
      return Yi(t, (function (t, r) {
        e[r] = n && "function" == typeof t ? Hi(t, n) : t
      })), e
    }, trim: function (e) {
      return e.replace(/^\s*/, "").replace(/\s*$/, "")
    }
  };

  function Wi(e) {
    return encodeURIComponent(e).replace(/%40/gi, "@").replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]")
  }

  var Xi = function (e, t, n) {
    if (!t) return e;
    var r;
    if (n) r = n(t); else if (zi.isURLSearchParams(t)) r = t.toString(); else {
      var o = [];
      zi.forEach(t, (function (e, t) {
        null != e && (zi.isArray(e) ? t += "[]" : e = [e], zi.forEach(e, (function (e) {
          zi.isDate(e) ? e = e.toISOString() : zi.isObject(e) && (e = JSON.stringify(e)), o.push(Wi(t) + "=" + Wi(e))
        })))
      })), r = o.join("&")
    }
    if (r) {
      var i = e.indexOf("#");
      -1 !== i && (e = e.slice(0, i)), e += (-1 === e.indexOf("?") ? "?" : "&") + r
    }
    return e
  };

  function Ji() {
    this.handlers = []
  }

  Ji.prototype.use = function (e, t) {
    return this.handlers.push({fulfilled: e, rejected: t}), this.handlers.length - 1
  }, Ji.prototype.eject = function (e) {
    this.handlers[e] && (this.handlers[e] = null)
  }, Ji.prototype.forEach = function (e) {
    zi.forEach(this.handlers, (function (t) {
      null !== t && e(t)
    }))
  };
  var Qi = Ji, Zi = function (e, t, n) {
    return zi.forEach(n, (function (n) {
      e = n(e, t)
    })), e
  }, es = function (e) {
    return !(!e || !e.__CANCEL__)
  };

  function ts() {
    throw new Error("setTimeout has not been defined")
  }

  function ns() {
    throw new Error("clearTimeout has not been defined")
  }

  var rs = ts, os = ns;

  function is(e) {
    if (rs === setTimeout) return setTimeout(e, 0);
    if ((rs === ts || !rs) && setTimeout) return rs = setTimeout, setTimeout(e, 0);
    try {
      return rs(e, 0)
    } catch (t) {
      try {
        return rs.call(null, e, 0)
      } catch (t) {
        return rs.call(this, e, 0)
      }
    }
  }

  "function" == typeof x.setTimeout && (rs = setTimeout), "function" == typeof x.clearTimeout && (os = clearTimeout);
  var ss, as = [], us = !1, cs = -1;

  function ls() {
    us && ss && (us = !1, ss.length ? as = ss.concat(as) : cs = -1, as.length && ps())
  }

  function ps() {
    if (!us) {
      var e = is(ls);
      us = !0;
      for (var t = as.length; t;) {
        for (ss = as, as = []; ++cs < t;) ss && ss[cs].run();
        cs = -1, t = as.length
      }
      ss = null, us = !1, function (e) {
        if (os === clearTimeout) return clearTimeout(e);
        if ((os === ns || !os) && clearTimeout) return os = clearTimeout, clearTimeout(e);
        try {
          os(e)
        } catch (t) {
          try {
            return os.call(null, e)
          } catch (t) {
            return os.call(this, e)
          }
        }
      }(e)
    }
  }

  function hs(e, t) {
    this.fun = e, this.array = t
  }

  hs.prototype.run = function () {
    this.fun.apply(null, this.array)
  };

  function fs() {
  }

  var gs = fs, ds = fs, ms = fs, ys = fs, vs = fs, _s = fs, Ms = fs;
  var Cs = x.performance || {}, Is = Cs.now || Cs.mozNow || Cs.msNow || Cs.oNow || Cs.webkitNow || function () {
    return (new Date).getTime()
  };
  var Ss = new Date;
  var Ds = {
      nextTick: function (e) {
        var t = new Array(arguments.length - 1);
        if (arguments.length > 1) for (var n = 1; n < arguments.length; n++) t[n - 1] = arguments[n];
        as.push(new hs(e, t)), 1 !== as.length || us || is(ps)
      },
      title: "browser",
      browser: !0,
      env: {},
      argv: [],
      version: "",
      versions: {},
      on: gs,
      addListener: ds,
      once: ms,
      off: ys,
      removeListener: vs,
      removeAllListeners: _s,
      emit: Ms,
      binding: function (e) {
        throw new Error("process.binding is not supported")
      },
      cwd: function () {
        return "/"
      },
      chdir: function (e) {
        throw new Error("process.chdir is not supported")
      },
      umask: function () {
        return 0
      },
      hrtime: function (e) {
        var t = .001 * Is.call(Cs), n = Math.floor(t), r = Math.floor(t % 1 * 1e9);
        return e && (n -= e[0], (r -= e[1]) < 0 && (n--, r += 1e9)), [n, r]
      },
      platform: "browser",
      release: {},
      config: {},
      uptime: function () {
        return (new Date - Ss) / 1e3
      }
    }, ks = function (e, t) {
      zi.forEach(e, (function (n, r) {
        r !== t && r.toUpperCase() === t.toUpperCase() && (e[t] = n, delete e[r])
      }))
    }, Ts = function (e, t, n, r, o) {
      return function (e, t, n, r, o) {
        return e.config = t, n && (e.code = n), e.request = r, e.response = o, e.isAxiosError = !0, e.toJSON = function () {
          return {
            message: this.message,
            name: this.name,
            description: this.description,
            number: this.number,
            fileName: this.fileName,
            lineNumber: this.lineNumber,
            columnNumber: this.columnNumber,
            stack: this.stack,
            config: this.config,
            code: this.code
          }
        }, e
      }(new Error(e), t, n, r, o)
    },
    Es = ["age", "authorization", "content-length", "content-type", "etag", "expires", "from", "host", "if-modified-since", "if-unmodified-since", "last-modified", "location", "max-forwards", "proxy-authorization", "referer", "retry-after", "user-agent"],
    ws = zi.isStandardBrowserEnv() ? function () {
      var e, t = /(msie|trident)/i.test(navigator.userAgent), n = document.createElement("a");

      function r(e) {
        var r = e;
        return t && (n.setAttribute("href", r), r = n.href), n.setAttribute("href", r), {
          href: n.href,
          protocol: n.protocol ? n.protocol.replace(/:$/, "") : "",
          host: n.host,
          search: n.search ? n.search.replace(/^\?/, "") : "",
          hash: n.hash ? n.hash.replace(/^#/, "") : "",
          hostname: n.hostname,
          port: n.port,
          pathname: "/" === n.pathname.charAt(0) ? n.pathname : "/" + n.pathname
        }
      }

      return e = r(window.location.href), function (t) {
        var n = zi.isString(t) ? r(t) : t;
        return n.protocol === e.protocol && n.host === e.host
      }
    }() : function () {
      return !0
    }, As = zi.isStandardBrowserEnv() ? {
      write: function (e, t, n, r, o, i) {
        var s = [];
        s.push(e + "=" + encodeURIComponent(t)), zi.isNumber(n) && s.push("expires=" + new Date(n).toGMTString()), zi.isString(r) && s.push("path=" + r), zi.isString(o) && s.push("domain=" + o), !0 === i && s.push("secure"), document.cookie = s.join("; ")
      }, read: function (e) {
        var t = document.cookie.match(new RegExp("(^|;\\s*)(" + e + ")=([^;]*)"));
        return t ? decodeURIComponent(t[3]) : null
      }, remove: function (e) {
        this.write(e, "", Date.now() - 864e5)
      }
    } : {
      write: function () {
      }, read: function () {
        return null
      }, remove: function () {
      }
    }, Rs = function (e) {
      return new Promise((function (t, n) {
        var r = e.data, o = e.headers;
        zi.isFormData(r) && delete o["Content-Type"];
        var i = new XMLHttpRequest;
        if (e.auth) {
          var s = e.auth.username || "", a = e.auth.password || "";
          o.Authorization = "Basic " + btoa(s + ":" + a)
        }
        var u, c, l = (u = e.baseURL, c = e.url, u && !/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(c) ? function (e, t) {
          return t ? e.replace(/\/+$/, "") + "/" + t.replace(/^\/+/, "") : e
        }(u, c) : c);
        if (i.open(e.method.toUpperCase(), Xi(l, e.params, e.paramsSerializer), !0), i.timeout = e.timeout, i.onreadystatechange = function () {
          if (i && 4 === i.readyState && (0 !== i.status || i.responseURL && 0 === i.responseURL.indexOf("file:"))) {
            var r, o, s, a, u,
              c = "getAllResponseHeaders" in i ? (r = i.getAllResponseHeaders(), u = {}, r ? (zi.forEach(r.split("\n"), (function (e) {
                if (a = e.indexOf(":"), o = zi.trim(e.substr(0, a)).toLowerCase(), s = zi.trim(e.substr(a + 1)), o) {
                  if (u[o] && Es.indexOf(o) >= 0) return;
                  u[o] = "set-cookie" === o ? (u[o] ? u[o] : []).concat([s]) : u[o] ? u[o] + ", " + s : s
                }
              })), u) : u) : null, l = {
                data: e.responseType && "text" !== e.responseType ? i.response : i.responseText,
                status: i.status,
                statusText: i.statusText,
                headers: c,
                config: e,
                request: i
              };
            !function (e, t, n) {
              var r = n.config.validateStatus;
              !r || r(n.status) ? e(n) : t(Ts("Request failed with status code " + n.status, n.config, null, n.request, n))
            }(t, n, l), i = null
          }
        }, i.onabort = function () {
          i && (n(Ts("Request aborted", e, "ECONNABORTED", i)), i = null)
        }, i.onerror = function () {
          n(Ts("Network Error", e, null, i)), i = null
        }, i.ontimeout = function () {
          var t = "timeout of " + e.timeout + "ms exceeded";
          e.timeoutErrorMessage && (t = e.timeoutErrorMessage), n(Ts(t, e, "ECONNABORTED", i)), i = null
        }, zi.isStandardBrowserEnv()) {
          var p = As, h = (e.withCredentials || ws(l)) && e.xsrfCookieName ? p.read(e.xsrfCookieName) : void 0;
          h && (o[e.xsrfHeaderName] = h)
        }
        if ("setRequestHeader" in i && zi.forEach(o, (function (e, t) {
          void 0 === r && "content-type" === t.toLowerCase() ? delete o[t] : i.setRequestHeader(t, e)
        })), zi.isUndefined(e.withCredentials) || (i.withCredentials = !!e.withCredentials), e.responseType) try {
          i.responseType = e.responseType
        } catch (f) {
          if ("json" !== e.responseType) throw f
        }
        "function" == typeof e.onDownloadProgress && i.addEventListener("progress", e.onDownloadProgress), "function" == typeof e.onUploadProgress && i.upload && i.upload.addEventListener("progress", e.onUploadProgress), e.cancelToken && e.cancelToken.promise.then((function (e) {
          i && (i.abort(), n(e), i = null)
        })), void 0 === r && (r = null), i.send(r)
      }))
    }, Ls = {"Content-Type": "application/x-www-form-urlencoded"};

  function Ps(e, t) {
    !zi.isUndefined(e) && zi.isUndefined(e["Content-Type"]) && (e["Content-Type"] = t)
  }

  var bs, Os = {
    adapter: ("undefined" != typeof XMLHttpRequest ? bs = Rs : void 0 !== Ds && "[object process]" === Object.prototype.toString.call(Ds) && (bs = Rs), bs),
    transformRequest: [function (e, t) {
      return ks(t, "Accept"), ks(t, "Content-Type"), zi.isFormData(e) || zi.isArrayBuffer(e) || zi.isBuffer(e) || zi.isStream(e) || zi.isFile(e) || zi.isBlob(e) ? e : zi.isArrayBufferView(e) ? e.buffer : zi.isURLSearchParams(e) ? (Ps(t, "application/x-www-form-urlencoded;charset=utf-8"), e.toString()) : zi.isObject(e) ? (Ps(t, "application/json;charset=utf-8"), JSON.stringify(e)) : e
    }],
    transformResponse: [function (e) {
      if ("string" == typeof e) try {
        e = JSON.parse(e)
      } catch (t) {
      }
      return e
    }],
    timeout: 0,
    xsrfCookieName: "XSRF-TOKEN",
    xsrfHeaderName: "X-XSRF-TOKEN",
    maxContentLength: -1,
    validateStatus: function (e) {
      return e >= 200 && e < 300
    }
  };
  Os.headers = {common: {Accept: "application/json, text/plain, */*"}}, zi.forEach(["delete", "get", "head"], (function (e) {
    Os.headers[e] = {}
  })), zi.forEach(["post", "put", "patch"], (function (e) {
    Os.headers[e] = zi.merge(Ls)
  }));
  var Ns = Os;

  function Gs(e) {
    e.cancelToken && e.cancelToken.throwIfRequested()
  }

  var Us = function (e) {
    return Gs(e), e.headers = e.headers || {}, e.data = Zi(e.data, e.headers, e.transformRequest), e.headers = zi.merge(e.headers.common || {}, e.headers[e.method] || {}, e.headers), zi.forEach(["delete", "get", "head", "post", "put", "patch", "common"], (function (t) {
      delete e.headers[t]
    })), (e.adapter || Ns.adapter)(e).then((function (t) {
      return Gs(e), t.data = Zi(t.data, t.headers, e.transformResponse), t
    }), (function (t) {
      return es(t) || (Gs(e), t && t.response && (t.response.data = Zi(t.response.data, t.response.headers, e.transformResponse))), Promise.reject(t)
    }))
  }, qs = function (e, t) {
    t = t || {};
    var n = {}, r = ["url", "method", "params", "data"], o = ["headers", "auth", "proxy"],
      i = ["baseURL", "url", "transformRequest", "transformResponse", "paramsSerializer", "timeout", "withCredentials", "adapter", "responseType", "xsrfCookieName", "xsrfHeaderName", "onUploadProgress", "onDownloadProgress", "maxContentLength", "validateStatus", "maxRedirects", "httpAgent", "httpsAgent", "cancelToken", "socketPath"];
    zi.forEach(r, (function (e) {
      void 0 !== t[e] && (n[e] = t[e])
    })), zi.forEach(o, (function (r) {
      zi.isObject(t[r]) ? n[r] = zi.deepMerge(e[r], t[r]) : void 0 !== t[r] ? n[r] = t[r] : zi.isObject(e[r]) ? n[r] = zi.deepMerge(e[r]) : void 0 !== e[r] && (n[r] = e[r])
    })), zi.forEach(i, (function (r) {
      void 0 !== t[r] ? n[r] = t[r] : void 0 !== e[r] && (n[r] = e[r])
    }));
    var s = r.concat(o).concat(i), a = Object.keys(t).filter((function (e) {
      return -1 === s.indexOf(e)
    }));
    return zi.forEach(a, (function (r) {
      void 0 !== t[r] ? n[r] = t[r] : void 0 !== e[r] && (n[r] = e[r])
    })), n
  };

  function xs(e) {
    this.defaults = e, this.interceptors = {request: new Qi, response: new Qi}
  }

  xs.prototype.request = function (e) {
    "string" == typeof e ? (e = arguments[1] || {}).url = arguments[0] : e = e || {}, (e = qs(this.defaults, e)).method ? e.method = e.method.toLowerCase() : this.defaults.method ? e.method = this.defaults.method.toLowerCase() : e.method = "get";
    var t = [Us, void 0], n = Promise.resolve(e);
    for (this.interceptors.request.forEach((function (e) {
      t.unshift(e.fulfilled, e.rejected)
    })), this.interceptors.response.forEach((function (e) {
      t.push(e.fulfilled, e.rejected)
    })); t.length;) n = n.then(t.shift(), t.shift());
    return n
  }, xs.prototype.getUri = function (e) {
    return e = qs(this.defaults, e), Xi(e.url, e.params, e.paramsSerializer).replace(/^\?/, "")
  }, zi.forEach(["delete", "get", "head", "options"], (function (e) {
    xs.prototype[e] = function (t, n) {
      return this.request(zi.merge(n || {}, {method: e, url: t}))
    }
  })), zi.forEach(["post", "put", "patch"], (function (e) {
    xs.prototype[e] = function (t, n, r) {
      return this.request(zi.merge(r || {}, {method: e, url: t, data: n}))
    }
  }));
  var Fs = xs;

  function Hs(e) {
    this.message = e
  }

  Hs.prototype.toString = function () {
    return "Cancel" + (this.message ? ": " + this.message : "")
  }, Hs.prototype.__CANCEL__ = !0;
  var Bs = Hs;

  function Ks(e) {
    if ("function" != typeof e) throw new TypeError("executor must be a function.");
    var t;
    this.promise = new Promise((function (e) {
      t = e
    }));
    var n = this;
    e((function (e) {
      n.reason || (n.reason = new Bs(e), t(n.reason))
    }))
  }

  Ks.prototype.throwIfRequested = function () {
    if (this.reason) throw this.reason
  }, Ks.source = function () {
    var e;
    return {
      token: new Ks((function (t) {
        e = t
      })), cancel: e
    }
  };
  var Vs = Ks;

  function js(e) {
    var t = new Fs(e), n = Hi(Fs.prototype.request, t);
    return zi.extend(n, Fs.prototype, t), zi.extend(n, t), n
  }

  var $s = js(Ns);
  $s.Axios = Fs, $s.create = function (e) {
    return js(qs($s.defaults, e))
  }, $s.Cancel = Bs, $s.CancelToken = Vs, $s.isCancel = es, $s.all = function (e) {
    return Promise.all(e)
  }, $s.spread = function (e) {
    return function (t) {
      return e.apply(null, t)
    }
  };
  var Ys = $s, zs = $s;
  Ys.default = zs;
  var Ws = Ys,
    Xs = Ws.create({timeout: 6e3, headers: {"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8"}});
  Xs.interceptors.response.use((function (e) {
    var t = e.data, n = t.error_code, r = t.ErrorCode;
    return X(n) && (r = n), r !== Re.SUCCESS && (e.data.ErrorCode = Number(r)), e
  }), (function (e) {
    return "Network Error" === e.message && (!0 === Xs.defaults.withCredentials && z.warn("Network Error, try to close `IMAxios.defaults.withCredentials` to false. (IMAxios.js)"), Xs.defaults.withCredentials = !1), Promise.reject(e)
  }));
  var Js = function () {
    function e() {
      r(this, e)
    }

    return i(e, [{
      key: "request", value: function (e) {
        console.warn("请注意： ConnectionBase.request() 方法必须被派生类重写:"), console.log("参数如下：\n    * @param {String} options.url string 是 开发者服务器接口地址\n    * @param {*} options.data - string/object/ArrayBuffer 否 请求的参数\n    * @param {Object} options.header - Object 否 设置请求的 header，\n    * @param {String} options.method - string GET 否 HTTP 请求方法\n    * @param {String} options.dataType - string json 否 返回的数据格式\n    * @param {String} options.responseType - string text 否 响应的数据类型\n    * @param {Boolean} isRetry - string text false 是否为重试的请求\n   ")
      }
    }, {
      key: "_checkOptions", value: function (e) {
        if (!1 == !!e.url) throw new lt({code: ln, message: Mr})
      }
    }, {
      key: "_initOptions", value: function (e) {
        e.method = ["POST", "GET", "PUT", "DELETE", "OPTION"].indexOf(e.method) >= 0 ? e.method : "POST", e.dataType = e.dataType || "json", e.responseType = e.responseType || "json"
      }
    }]), e
  }(), Qs = function (e) {
    function t() {
      var e;
      return r(this, t), (e = m(this, l(t).call(this))).retry = 2, e
    }

    return c(t, e), i(t, [{
      key: "request", value: function (e) {
        return this._checkOptions(e), this._initOptions(e), this._requestWithRetry({
          url: e.url,
          data: e.data,
          method: e.method
        })
      }
    }, {
      key: "_requestWithRetry", value: function (e) {
        var t = this, n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0;
        return Xs(e).catch((function (r) {
          return t.retry && n < t.retry ? t._requestWithRetry(e, ++n) : Zo(new lt({
            code: r.code || "",
            message: r.message || ""
          }))
        }))
      }
    }]), t
  }(Js), Zs = [], ea = [], ta = "undefined" != typeof Uint8Array ? Uint8Array : Array, na = !1;

  function ra() {
    na = !0;
    for (var e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", t = 0, n = e.length; t < n; ++t) Zs[t] = e[t], ea[e.charCodeAt(t)] = t;
    ea["-".charCodeAt(0)] = 62, ea["_".charCodeAt(0)] = 63
  }

  function oa(e, t, n) {
    for (var r, o, i = [], s = t; s < n; s += 3) r = (e[s] << 16) + (e[s + 1] << 8) + e[s + 2], i.push(Zs[(o = r) >> 18 & 63] + Zs[o >> 12 & 63] + Zs[o >> 6 & 63] + Zs[63 & o]);
    return i.join("")
  }

  function ia(e) {
    var t;
    na || ra();
    for (var n = e.length, r = n % 3, o = "", i = [], s = 0, a = n - r; s < a; s += 16383) i.push(oa(e, s, s + 16383 > a ? a : s + 16383));
    return 1 === r ? (t = e[n - 1], o += Zs[t >> 2], o += Zs[t << 4 & 63], o += "==") : 2 === r && (t = (e[n - 2] << 8) + e[n - 1], o += Zs[t >> 10], o += Zs[t >> 4 & 63], o += Zs[t << 2 & 63], o += "="), i.push(o), i.join("")
  }

  function sa(e, t, n, r, o) {
    var i, s, a = 8 * o - r - 1, u = (1 << a) - 1, c = u >> 1, l = -7, p = n ? o - 1 : 0, h = n ? -1 : 1, f = e[t + p];
    for (p += h, i = f & (1 << -l) - 1, f >>= -l, l += a; l > 0; i = 256 * i + e[t + p], p += h, l -= 8) ;
    for (s = i & (1 << -l) - 1, i >>= -l, l += r; l > 0; s = 256 * s + e[t + p], p += h, l -= 8) ;
    if (0 === i) i = 1 - c; else {
      if (i === u) return s ? NaN : Infinity * (f ? -1 : 1);
      s += Math.pow(2, r), i -= c
    }
    return (f ? -1 : 1) * s * Math.pow(2, i - r)
  }

  function aa(e, t, n, r, o, i) {
    var s, a, u, c = 8 * i - o - 1, l = (1 << c) - 1, p = l >> 1,
      h = 23 === o ? Math.pow(2, -24) - Math.pow(2, -77) : 0, f = r ? 0 : i - 1, g = r ? 1 : -1,
      d = t < 0 || 0 === t && 1 / t < 0 ? 1 : 0;
    for (t = Math.abs(t), isNaN(t) || Infinity === t ? (a = isNaN(t) ? 1 : 0, s = l) : (s = Math.floor(Math.log(t) / Math.LN2), t * (u = Math.pow(2, -s)) < 1 && (s--, u *= 2), (t += s + p >= 1 ? h / u : h * Math.pow(2, 1 - p)) * u >= 2 && (s++, u /= 2), s + p >= l ? (a = 0, s = l) : s + p >= 1 ? (a = (t * u - 1) * Math.pow(2, o), s += p) : (a = t * Math.pow(2, p - 1) * Math.pow(2, o), s = 0)); o >= 8; e[n + f] = 255 & a, f += g, a /= 256, o -= 8) ;
    for (s = s << o | a, c += o; c > 0; e[n + f] = 255 & s, f += g, s /= 256, c -= 8) ;
    e[n + f - g] |= 128 * d
  }

  var ua = {}.toString, ca = Array.isArray || function (e) {
    return "[object Array]" == ua.call(e)
  };

  function la() {
    return ha.TYPED_ARRAY_SUPPORT ? 2147483647 : 1073741823
  }

  function pa(e, t) {
    if (la() < t) throw new RangeError("Invalid typed array length");
    return ha.TYPED_ARRAY_SUPPORT ? (e = new Uint8Array(t)).__proto__ = ha.prototype : (null === e && (e = new ha(t)), e.length = t), e
  }

  function ha(e, t, n) {
    if (!(ha.TYPED_ARRAY_SUPPORT || this instanceof ha)) return new ha(e, t, n);
    if ("number" == typeof e) {
      if ("string" == typeof t) throw new Error("If encoding is specified then the first argument must be a string");
      return da(this, e)
    }
    return fa(this, e, t, n)
  }

  function fa(e, t, n, r) {
    if ("number" == typeof t) throw new TypeError('"value" argument must not be a number');
    return "undefined" != typeof ArrayBuffer && t instanceof ArrayBuffer ? function (e, t, n, r) {
      if (t.byteLength, n < 0 || t.byteLength < n) throw new RangeError("'offset' is out of bounds");
      if (t.byteLength < n + (r || 0)) throw new RangeError("'length' is out of bounds");
      t = void 0 === n && void 0 === r ? new Uint8Array(t) : void 0 === r ? new Uint8Array(t, n) : new Uint8Array(t, n, r);
      ha.TYPED_ARRAY_SUPPORT ? (e = t).__proto__ = ha.prototype : e = ma(e, t);
      return e
    }(e, t, n, r) : "string" == typeof t ? function (e, t, n) {
      "string" == typeof n && "" !== n || (n = "utf8");
      if (!ha.isEncoding(n)) throw new TypeError('"encoding" must be a valid string encoding');
      var r = 0 | _a(t, n), o = (e = pa(e, r)).write(t, n);
      o !== r && (e = e.slice(0, o));
      return e
    }(e, t, n) : function (e, t) {
      if (va(t)) {
        var n = 0 | ya(t.length);
        return 0 === (e = pa(e, n)).length ? e : (t.copy(e, 0, 0, n), e)
      }
      if (t) {
        if ("undefined" != typeof ArrayBuffer && t.buffer instanceof ArrayBuffer || "length" in t) return "number" != typeof t.length || (r = t.length) != r ? pa(e, 0) : ma(e, t);
        if ("Buffer" === t.type && ca(t.data)) return ma(e, t.data)
      }
      var r;
      throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")
    }(e, t)
  }

  function ga(e) {
    if ("number" != typeof e) throw new TypeError('"size" argument must be a number');
    if (e < 0) throw new RangeError('"size" argument must not be negative')
  }

  function da(e, t) {
    if (ga(t), e = pa(e, t < 0 ? 0 : 0 | ya(t)), !ha.TYPED_ARRAY_SUPPORT) for (var n = 0; n < t; ++n) e[n] = 0;
    return e
  }

  function ma(e, t) {
    var n = t.length < 0 ? 0 : 0 | ya(t.length);
    e = pa(e, n);
    for (var r = 0; r < n; r += 1) e[r] = 255 & t[r];
    return e
  }

  function ya(e) {
    if (e >= la()) throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + la().toString(16) + " bytes");
    return 0 | e
  }

  function va(e) {
    return !(null == e || !e._isBuffer)
  }

  function _a(e, t) {
    if (va(e)) return e.length;
    if ("undefined" != typeof ArrayBuffer && "function" == typeof ArrayBuffer.isView && (ArrayBuffer.isView(e) || e instanceof ArrayBuffer)) return e.byteLength;
    "string" != typeof e && (e = "" + e);
    var n = e.length;
    if (0 === n) return 0;
    for (var r = !1; ;) switch (t) {
      case"ascii":
      case"latin1":
      case"binary":
        return n;
      case"utf8":
      case"utf-8":
      case void 0:
        return ja(e).length;
      case"ucs2":
      case"ucs-2":
      case"utf16le":
      case"utf-16le":
        return 2 * n;
      case"hex":
        return n >>> 1;
      case"base64":
        return $a(e).length;
      default:
        if (r) return ja(e).length;
        t = ("" + t).toLowerCase(), r = !0
    }
  }

  function Ma(e, t, n) {
    var r = !1;
    if ((void 0 === t || t < 0) && (t = 0), t > this.length) return "";
    if ((void 0 === n || n > this.length) && (n = this.length), n <= 0) return "";
    if ((n >>>= 0) <= (t >>>= 0)) return "";
    for (e || (e = "utf8"); ;) switch (e) {
      case"hex":
        return Oa(this, t, n);
      case"utf8":
      case"utf-8":
        return La(this, t, n);
      case"ascii":
        return Pa(this, t, n);
      case"latin1":
      case"binary":
        return ba(this, t, n);
      case"base64":
        return Ra(this, t, n);
      case"ucs2":
      case"ucs-2":
      case"utf16le":
      case"utf-16le":
        return Na(this, t, n);
      default:
        if (r) throw new TypeError("Unknown encoding: " + e);
        e = (e + "").toLowerCase(), r = !0
    }
  }

  function Ca(e, t, n) {
    var r = e[t];
    e[t] = e[n], e[n] = r
  }

  function Ia(e, t, n, r, o) {
    if (0 === e.length) return -1;
    if ("string" == typeof n ? (r = n, n = 0) : n > 2147483647 ? n = 2147483647 : n < -2147483648 && (n = -2147483648), n = +n, isNaN(n) && (n = o ? 0 : e.length - 1), n < 0 && (n = e.length + n), n >= e.length) {
      if (o) return -1;
      n = e.length - 1
    } else if (n < 0) {
      if (!o) return -1;
      n = 0
    }
    if ("string" == typeof t && (t = ha.from(t, r)), va(t)) return 0 === t.length ? -1 : Sa(e, t, n, r, o);
    if ("number" == typeof t) return t &= 255, ha.TYPED_ARRAY_SUPPORT && "function" == typeof Uint8Array.prototype.indexOf ? o ? Uint8Array.prototype.indexOf.call(e, t, n) : Uint8Array.prototype.lastIndexOf.call(e, t, n) : Sa(e, [t], n, r, o);
    throw new TypeError("val must be string, number or Buffer")
  }

  function Sa(e, t, n, r, o) {
    var i, s = 1, a = e.length, u = t.length;
    if (void 0 !== r && ("ucs2" === (r = String(r).toLowerCase()) || "ucs-2" === r || "utf16le" === r || "utf-16le" === r)) {
      if (e.length < 2 || t.length < 2) return -1;
      s = 2, a /= 2, u /= 2, n /= 2
    }

    function c(e, t) {
      return 1 === s ? e[t] : e.readUInt16BE(t * s)
    }

    if (o) {
      var l = -1;
      for (i = n; i < a; i++) if (c(e, i) === c(t, -1 === l ? 0 : i - l)) {
        if (-1 === l && (l = i), i - l + 1 === u) return l * s
      } else -1 !== l && (i -= i - l), l = -1
    } else for (n + u > a && (n = a - u), i = n; i >= 0; i--) {
      for (var p = !0, h = 0; h < u; h++) if (c(e, i + h) !== c(t, h)) {
        p = !1;
        break
      }
      if (p) return i
    }
    return -1
  }

  function Da(e, t, n, r) {
    n = Number(n) || 0;
    var o = e.length - n;
    r ? (r = Number(r)) > o && (r = o) : r = o;
    var i = t.length;
    if (i % 2 != 0) throw new TypeError("Invalid hex string");
    r > i / 2 && (r = i / 2);
    for (var s = 0; s < r; ++s) {
      var a = parseInt(t.substr(2 * s, 2), 16);
      if (isNaN(a)) return s;
      e[n + s] = a
    }
    return s
  }

  function ka(e, t, n, r) {
    return Ya(ja(t, e.length - n), e, n, r)
  }

  function Ta(e, t, n, r) {
    return Ya(function (e) {
      for (var t = [], n = 0; n < e.length; ++n) t.push(255 & e.charCodeAt(n));
      return t
    }(t), e, n, r)
  }

  function Ea(e, t, n, r) {
    return Ta(e, t, n, r)
  }

  function wa(e, t, n, r) {
    return Ya($a(t), e, n, r)
  }

  function Aa(e, t, n, r) {
    return Ya(function (e, t) {
      for (var n, r, o, i = [], s = 0; s < e.length && !((t -= 2) < 0); ++s) n = e.charCodeAt(s), r = n >> 8, o = n % 256, i.push(o), i.push(r);
      return i
    }(t, e.length - n), e, n, r)
  }

  function Ra(e, t, n) {
    return 0 === t && n === e.length ? ia(e) : ia(e.slice(t, n))
  }

  function La(e, t, n) {
    n = Math.min(e.length, n);
    for (var r = [], o = t; o < n;) {
      var i, s, a, u, c = e[o], l = null, p = c > 239 ? 4 : c > 223 ? 3 : c > 191 ? 2 : 1;
      if (o + p <= n) switch (p) {
        case 1:
          c < 128 && (l = c);
          break;
        case 2:
          128 == (192 & (i = e[o + 1])) && (u = (31 & c) << 6 | 63 & i) > 127 && (l = u);
          break;
        case 3:
          i = e[o + 1], s = e[o + 2], 128 == (192 & i) && 128 == (192 & s) && (u = (15 & c) << 12 | (63 & i) << 6 | 63 & s) > 2047 && (u < 55296 || u > 57343) && (l = u);
          break;
        case 4:
          i = e[o + 1], s = e[o + 2], a = e[o + 3], 128 == (192 & i) && 128 == (192 & s) && 128 == (192 & a) && (u = (15 & c) << 18 | (63 & i) << 12 | (63 & s) << 6 | 63 & a) > 65535 && u < 1114112 && (l = u)
      }
      null === l ? (l = 65533, p = 1) : l > 65535 && (l -= 65536, r.push(l >>> 10 & 1023 | 55296), l = 56320 | 1023 & l), r.push(l), o += p
    }
    return function (e) {
      var t = e.length;
      if (t <= 4096) return String.fromCharCode.apply(String, e);
      var n = "", r = 0;
      for (; r < t;) n += String.fromCharCode.apply(String, e.slice(r, r += 4096));
      return n
    }(r)
  }

  ha.TYPED_ARRAY_SUPPORT = void 0 === x.TYPED_ARRAY_SUPPORT || x.TYPED_ARRAY_SUPPORT, ha.poolSize = 8192, ha._augment = function (e) {
    return e.__proto__ = ha.prototype, e
  }, ha.from = function (e, t, n) {
    return fa(null, e, t, n)
  }, ha.TYPED_ARRAY_SUPPORT && (ha.prototype.__proto__ = Uint8Array.prototype, ha.__proto__ = Uint8Array), ha.alloc = function (e, t, n) {
    return function (e, t, n, r) {
      return ga(t), t <= 0 ? pa(e, t) : void 0 !== n ? "string" == typeof r ? pa(e, t).fill(n, r) : pa(e, t).fill(n) : pa(e, t)
    }(null, e, t, n)
  }, ha.allocUnsafe = function (e) {
    return da(null, e)
  }, ha.allocUnsafeSlow = function (e) {
    return da(null, e)
  }, ha.isBuffer = function (e) {
    return null != e && (!!e._isBuffer || za(e) || function (e) {
      return "function" == typeof e.readFloatLE && "function" == typeof e.slice && za(e.slice(0, 0))
    }(e))
  }, ha.compare = function (e, t) {
    if (!va(e) || !va(t)) throw new TypeError("Arguments must be Buffers");
    if (e === t) return 0;
    for (var n = e.length, r = t.length, o = 0, i = Math.min(n, r); o < i; ++o) if (e[o] !== t[o]) {
      n = e[o], r = t[o];
      break
    }
    return n < r ? -1 : r < n ? 1 : 0
  }, ha.isEncoding = function (e) {
    switch (String(e).toLowerCase()) {
      case"hex":
      case"utf8":
      case"utf-8":
      case"ascii":
      case"latin1":
      case"binary":
      case"base64":
      case"ucs2":
      case"ucs-2":
      case"utf16le":
      case"utf-16le":
        return !0;
      default:
        return !1
    }
  }, ha.concat = function (e, t) {
    if (!ca(e)) throw new TypeError('"list" argument must be an Array of Buffers');
    if (0 === e.length) return ha.alloc(0);
    var n;
    if (void 0 === t) for (t = 0, n = 0; n < e.length; ++n) t += e[n].length;
    var r = ha.allocUnsafe(t), o = 0;
    for (n = 0; n < e.length; ++n) {
      var i = e[n];
      if (!va(i)) throw new TypeError('"list" argument must be an Array of Buffers');
      i.copy(r, o), o += i.length
    }
    return r
  }, ha.byteLength = _a, ha.prototype._isBuffer = !0, ha.prototype.swap16 = function () {
    var e = this.length;
    if (e % 2 != 0) throw new RangeError("Buffer size must be a multiple of 16-bits");
    for (var t = 0; t < e; t += 2) Ca(this, t, t + 1);
    return this
  }, ha.prototype.swap32 = function () {
    var e = this.length;
    if (e % 4 != 0) throw new RangeError("Buffer size must be a multiple of 32-bits");
    for (var t = 0; t < e; t += 4) Ca(this, t, t + 3), Ca(this, t + 1, t + 2);
    return this
  }, ha.prototype.swap64 = function () {
    var e = this.length;
    if (e % 8 != 0) throw new RangeError("Buffer size must be a multiple of 64-bits");
    for (var t = 0; t < e; t += 8) Ca(this, t, t + 7), Ca(this, t + 1, t + 6), Ca(this, t + 2, t + 5), Ca(this, t + 3, t + 4);
    return this
  }, ha.prototype.toString = function () {
    var e = 0 | this.length;
    return 0 === e ? "" : 0 === arguments.length ? La(this, 0, e) : Ma.apply(this, arguments)
  }, ha.prototype.equals = function (e) {
    if (!va(e)) throw new TypeError("Argument must be a Buffer");
    return this === e || 0 === ha.compare(this, e)
  }, ha.prototype.inspect = function () {
    var e = "";
    return this.length > 0 && (e = this.toString("hex", 0, 50).match(/.{2}/g).join(" "), this.length > 50 && (e += " ... ")), "<Buffer " + e + ">"
  }, ha.prototype.compare = function (e, t, n, r, o) {
    if (!va(e)) throw new TypeError("Argument must be a Buffer");
    if (void 0 === t && (t = 0), void 0 === n && (n = e ? e.length : 0), void 0 === r && (r = 0), void 0 === o && (o = this.length), t < 0 || n > e.length || r < 0 || o > this.length) throw new RangeError("out of range index");
    if (r >= o && t >= n) return 0;
    if (r >= o) return -1;
    if (t >= n) return 1;
    if (this === e) return 0;
    for (var i = (o >>>= 0) - (r >>>= 0), s = (n >>>= 0) - (t >>>= 0), a = Math.min(i, s), u = this.slice(r, o), c = e.slice(t, n), l = 0; l < a; ++l) if (u[l] !== c[l]) {
      i = u[l], s = c[l];
      break
    }
    return i < s ? -1 : s < i ? 1 : 0
  }, ha.prototype.includes = function (e, t, n) {
    return -1 !== this.indexOf(e, t, n)
  }, ha.prototype.indexOf = function (e, t, n) {
    return Ia(this, e, t, n, !0)
  }, ha.prototype.lastIndexOf = function (e, t, n) {
    return Ia(this, e, t, n, !1)
  }, ha.prototype.write = function (e, t, n, r) {
    if (void 0 === t) r = "utf8", n = this.length, t = 0; else if (void 0 === n && "string" == typeof t) r = t, n = this.length, t = 0; else {
      if (!isFinite(t)) throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");
      t |= 0, isFinite(n) ? (n |= 0, void 0 === r && (r = "utf8")) : (r = n, n = void 0)
    }
    var o = this.length - t;
    if ((void 0 === n || n > o) && (n = o), e.length > 0 && (n < 0 || t < 0) || t > this.length) throw new RangeError("Attempt to write outside buffer bounds");
    r || (r = "utf8");
    for (var i = !1; ;) switch (r) {
      case"hex":
        return Da(this, e, t, n);
      case"utf8":
      case"utf-8":
        return ka(this, e, t, n);
      case"ascii":
        return Ta(this, e, t, n);
      case"latin1":
      case"binary":
        return Ea(this, e, t, n);
      case"base64":
        return wa(this, e, t, n);
      case"ucs2":
      case"ucs-2":
      case"utf16le":
      case"utf-16le":
        return Aa(this, e, t, n);
      default:
        if (i) throw new TypeError("Unknown encoding: " + r);
        r = ("" + r).toLowerCase(), i = !0
    }
  }, ha.prototype.toJSON = function () {
    return {type: "Buffer", data: Array.prototype.slice.call(this._arr || this, 0)}
  };

  function Pa(e, t, n) {
    var r = "";
    n = Math.min(e.length, n);
    for (var o = t; o < n; ++o) r += String.fromCharCode(127 & e[o]);
    return r
  }

  function ba(e, t, n) {
    var r = "";
    n = Math.min(e.length, n);
    for (var o = t; o < n; ++o) r += String.fromCharCode(e[o]);
    return r
  }

  function Oa(e, t, n) {
    var r = e.length;
    (!t || t < 0) && (t = 0), (!n || n < 0 || n > r) && (n = r);
    for (var o = "", i = t; i < n; ++i) o += Va(e[i]);
    return o
  }

  function Na(e, t, n) {
    for (var r = e.slice(t, n), o = "", i = 0; i < r.length; i += 2) o += String.fromCharCode(r[i] + 256 * r[i + 1]);
    return o
  }

  function Ga(e, t, n) {
    if (e % 1 != 0 || e < 0) throw new RangeError("offset is not uint");
    if (e + t > n) throw new RangeError("Trying to access beyond buffer length")
  }

  function Ua(e, t, n, r, o, i) {
    if (!va(e)) throw new TypeError('"buffer" argument must be a Buffer instance');
    if (t > o || t < i) throw new RangeError('"value" argument is out of bounds');
    if (n + r > e.length) throw new RangeError("Index out of range")
  }

  function qa(e, t, n, r) {
    t < 0 && (t = 65535 + t + 1);
    for (var o = 0, i = Math.min(e.length - n, 2); o < i; ++o) e[n + o] = (t & 255 << 8 * (r ? o : 1 - o)) >>> 8 * (r ? o : 1 - o)
  }

  function xa(e, t, n, r) {
    t < 0 && (t = 4294967295 + t + 1);
    for (var o = 0, i = Math.min(e.length - n, 4); o < i; ++o) e[n + o] = t >>> 8 * (r ? o : 3 - o) & 255
  }

  function Fa(e, t, n, r, o, i) {
    if (n + r > e.length) throw new RangeError("Index out of range");
    if (n < 0) throw new RangeError("Index out of range")
  }

  function Ha(e, t, n, r, o) {
    return o || Fa(e, 0, n, 4), aa(e, t, n, r, 23, 4), n + 4
  }

  function Ba(e, t, n, r, o) {
    return o || Fa(e, 0, n, 8), aa(e, t, n, r, 52, 8), n + 8
  }

  ha.prototype.slice = function (e, t) {
    var n, r = this.length;
    if ((e = ~~e) < 0 ? (e += r) < 0 && (e = 0) : e > r && (e = r), (t = void 0 === t ? r : ~~t) < 0 ? (t += r) < 0 && (t = 0) : t > r && (t = r), t < e && (t = e), ha.TYPED_ARRAY_SUPPORT) (n = this.subarray(e, t)).__proto__ = ha.prototype; else {
      var o = t - e;
      n = new ha(o, void 0);
      for (var i = 0; i < o; ++i) n[i] = this[i + e]
    }
    return n
  }, ha.prototype.readUIntLE = function (e, t, n) {
    e |= 0, t |= 0, n || Ga(e, t, this.length);
    for (var r = this[e], o = 1, i = 0; ++i < t && (o *= 256);) r += this[e + i] * o;
    return r
  }, ha.prototype.readUIntBE = function (e, t, n) {
    e |= 0, t |= 0, n || Ga(e, t, this.length);
    for (var r = this[e + --t], o = 1; t > 0 && (o *= 256);) r += this[e + --t] * o;
    return r
  }, ha.prototype.readUInt8 = function (e, t) {
    return t || Ga(e, 1, this.length), this[e]
  }, ha.prototype.readUInt16LE = function (e, t) {
    return t || Ga(e, 2, this.length), this[e] | this[e + 1] << 8
  }, ha.prototype.readUInt16BE = function (e, t) {
    return t || Ga(e, 2, this.length), this[e] << 8 | this[e + 1]
  }, ha.prototype.readUInt32LE = function (e, t) {
    return t || Ga(e, 4, this.length), (this[e] | this[e + 1] << 8 | this[e + 2] << 16) + 16777216 * this[e + 3]
  }, ha.prototype.readUInt32BE = function (e, t) {
    return t || Ga(e, 4, this.length), 16777216 * this[e] + (this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3])
  }, ha.prototype.readIntLE = function (e, t, n) {
    e |= 0, t |= 0, n || Ga(e, t, this.length);
    for (var r = this[e], o = 1, i = 0; ++i < t && (o *= 256);) r += this[e + i] * o;
    return r >= (o *= 128) && (r -= Math.pow(2, 8 * t)), r
  }, ha.prototype.readIntBE = function (e, t, n) {
    e |= 0, t |= 0, n || Ga(e, t, this.length);
    for (var r = t, o = 1, i = this[e + --r]; r > 0 && (o *= 256);) i += this[e + --r] * o;
    return i >= (o *= 128) && (i -= Math.pow(2, 8 * t)), i
  }, ha.prototype.readInt8 = function (e, t) {
    return t || Ga(e, 1, this.length), 128 & this[e] ? -1 * (255 - this[e] + 1) : this[e]
  }, ha.prototype.readInt16LE = function (e, t) {
    t || Ga(e, 2, this.length);
    var n = this[e] | this[e + 1] << 8;
    return 32768 & n ? 4294901760 | n : n
  }, ha.prototype.readInt16BE = function (e, t) {
    t || Ga(e, 2, this.length);
    var n = this[e + 1] | this[e] << 8;
    return 32768 & n ? 4294901760 | n : n
  }, ha.prototype.readInt32LE = function (e, t) {
    return t || Ga(e, 4, this.length), this[e] | this[e + 1] << 8 | this[e + 2] << 16 | this[e + 3] << 24
  }, ha.prototype.readInt32BE = function (e, t) {
    return t || Ga(e, 4, this.length), this[e] << 24 | this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3]
  }, ha.prototype.readFloatLE = function (e, t) {
    return t || Ga(e, 4, this.length), sa(this, e, !0, 23, 4)
  }, ha.prototype.readFloatBE = function (e, t) {
    return t || Ga(e, 4, this.length), sa(this, e, !1, 23, 4)
  }, ha.prototype.readDoubleLE = function (e, t) {
    return t || Ga(e, 8, this.length), sa(this, e, !0, 52, 8)
  }, ha.prototype.readDoubleBE = function (e, t) {
    return t || Ga(e, 8, this.length), sa(this, e, !1, 52, 8)
  }, ha.prototype.writeUIntLE = function (e, t, n, r) {
    (e = +e, t |= 0, n |= 0, r) || Ua(this, e, t, n, Math.pow(2, 8 * n) - 1, 0);
    var o = 1, i = 0;
    for (this[t] = 255 & e; ++i < n && (o *= 256);) this[t + i] = e / o & 255;
    return t + n
  }, ha.prototype.writeUIntBE = function (e, t, n, r) {
    (e = +e, t |= 0, n |= 0, r) || Ua(this, e, t, n, Math.pow(2, 8 * n) - 1, 0);
    var o = n - 1, i = 1;
    for (this[t + o] = 255 & e; --o >= 0 && (i *= 256);) this[t + o] = e / i & 255;
    return t + n
  }, ha.prototype.writeUInt8 = function (e, t, n) {
    return e = +e, t |= 0, n || Ua(this, e, t, 1, 255, 0), ha.TYPED_ARRAY_SUPPORT || (e = Math.floor(e)), this[t] = 255 & e, t + 1
  }, ha.prototype.writeUInt16LE = function (e, t, n) {
    return e = +e, t |= 0, n || Ua(this, e, t, 2, 65535, 0), ha.TYPED_ARRAY_SUPPORT ? (this[t] = 255 & e, this[t + 1] = e >>> 8) : qa(this, e, t, !0), t + 2
  }, ha.prototype.writeUInt16BE = function (e, t, n) {
    return e = +e, t |= 0, n || Ua(this, e, t, 2, 65535, 0), ha.TYPED_ARRAY_SUPPORT ? (this[t] = e >>> 8, this[t + 1] = 255 & e) : qa(this, e, t, !1), t + 2
  }, ha.prototype.writeUInt32LE = function (e, t, n) {
    return e = +e, t |= 0, n || Ua(this, e, t, 4, 4294967295, 0), ha.TYPED_ARRAY_SUPPORT ? (this[t + 3] = e >>> 24, this[t + 2] = e >>> 16, this[t + 1] = e >>> 8, this[t] = 255 & e) : xa(this, e, t, !0), t + 4
  }, ha.prototype.writeUInt32BE = function (e, t, n) {
    return e = +e, t |= 0, n || Ua(this, e, t, 4, 4294967295, 0), ha.TYPED_ARRAY_SUPPORT ? (this[t] = e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>> 8, this[t + 3] = 255 & e) : xa(this, e, t, !1), t + 4
  }, ha.prototype.writeIntLE = function (e, t, n, r) {
    if (e = +e, t |= 0, !r) {
      var o = Math.pow(2, 8 * n - 1);
      Ua(this, e, t, n, o - 1, -o)
    }
    var i = 0, s = 1, a = 0;
    for (this[t] = 255 & e; ++i < n && (s *= 256);) e < 0 && 0 === a && 0 !== this[t + i - 1] && (a = 1), this[t + i] = (e / s >> 0) - a & 255;
    return t + n
  }, ha.prototype.writeIntBE = function (e, t, n, r) {
    if (e = +e, t |= 0, !r) {
      var o = Math.pow(2, 8 * n - 1);
      Ua(this, e, t, n, o - 1, -o)
    }
    var i = n - 1, s = 1, a = 0;
    for (this[t + i] = 255 & e; --i >= 0 && (s *= 256);) e < 0 && 0 === a && 0 !== this[t + i + 1] && (a = 1), this[t + i] = (e / s >> 0) - a & 255;
    return t + n
  }, ha.prototype.writeInt8 = function (e, t, n) {
    return e = +e, t |= 0, n || Ua(this, e, t, 1, 127, -128), ha.TYPED_ARRAY_SUPPORT || (e = Math.floor(e)), e < 0 && (e = 255 + e + 1), this[t] = 255 & e, t + 1
  }, ha.prototype.writeInt16LE = function (e, t, n) {
    return e = +e, t |= 0, n || Ua(this, e, t, 2, 32767, -32768), ha.TYPED_ARRAY_SUPPORT ? (this[t] = 255 & e, this[t + 1] = e >>> 8) : qa(this, e, t, !0), t + 2
  }, ha.prototype.writeInt16BE = function (e, t, n) {
    return e = +e, t |= 0, n || Ua(this, e, t, 2, 32767, -32768), ha.TYPED_ARRAY_SUPPORT ? (this[t] = e >>> 8, this[t + 1] = 255 & e) : qa(this, e, t, !1), t + 2
  }, ha.prototype.writeInt32LE = function (e, t, n) {
    return e = +e, t |= 0, n || Ua(this, e, t, 4, 2147483647, -2147483648), ha.TYPED_ARRAY_SUPPORT ? (this[t] = 255 & e, this[t + 1] = e >>> 8, this[t + 2] = e >>> 16, this[t + 3] = e >>> 24) : xa(this, e, t, !0), t + 4
  }, ha.prototype.writeInt32BE = function (e, t, n) {
    return e = +e, t |= 0, n || Ua(this, e, t, 4, 2147483647, -2147483648), e < 0 && (e = 4294967295 + e + 1), ha.TYPED_ARRAY_SUPPORT ? (this[t] = e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>> 8, this[t + 3] = 255 & e) : xa(this, e, t, !1), t + 4
  }, ha.prototype.writeFloatLE = function (e, t, n) {
    return Ha(this, e, t, !0, n)
  }, ha.prototype.writeFloatBE = function (e, t, n) {
    return Ha(this, e, t, !1, n)
  }, ha.prototype.writeDoubleLE = function (e, t, n) {
    return Ba(this, e, t, !0, n)
  }, ha.prototype.writeDoubleBE = function (e, t, n) {
    return Ba(this, e, t, !1, n)
  }, ha.prototype.copy = function (e, t, n, r) {
    if (n || (n = 0), r || 0 === r || (r = this.length), t >= e.length && (t = e.length), t || (t = 0), r > 0 && r < n && (r = n), r === n) return 0;
    if (0 === e.length || 0 === this.length) return 0;
    if (t < 0) throw new RangeError("targetStart out of bounds");
    if (n < 0 || n >= this.length) throw new RangeError("sourceStart out of bounds");
    if (r < 0) throw new RangeError("sourceEnd out of bounds");
    r > this.length && (r = this.length), e.length - t < r - n && (r = e.length - t + n);
    var o, i = r - n;
    if (this === e && n < t && t < r) for (o = i - 1; o >= 0; --o) e[o + t] = this[o + n]; else if (i < 1e3 || !ha.TYPED_ARRAY_SUPPORT) for (o = 0; o < i; ++o) e[o + t] = this[o + n]; else Uint8Array.prototype.set.call(e, this.subarray(n, n + i), t);
    return i
  }, ha.prototype.fill = function (e, t, n, r) {
    if ("string" == typeof e) {
      if ("string" == typeof t ? (r = t, t = 0, n = this.length) : "string" == typeof n && (r = n, n = this.length), 1 === e.length) {
        var o = e.charCodeAt(0);
        o < 256 && (e = o)
      }
      if (void 0 !== r && "string" != typeof r) throw new TypeError("encoding must be a string");
      if ("string" == typeof r && !ha.isEncoding(r)) throw new TypeError("Unknown encoding: " + r)
    } else "number" == typeof e && (e &= 255);
    if (t < 0 || this.length < t || this.length < n) throw new RangeError("Out of range index");
    if (n <= t) return this;
    var i;
    if (t >>>= 0, n = void 0 === n ? this.length : n >>> 0, e || (e = 0), "number" == typeof e) for (i = t; i < n; ++i) this[i] = e; else {
      var s = va(e) ? e : ja(new ha(e, r).toString()), a = s.length;
      for (i = 0; i < n - t; ++i) this[i + t] = s[i % a]
    }
    return this
  };
  var Ka = /[^+\/0-9A-Za-z-_]/g;

  function Va(e) {
    return e < 16 ? "0" + e.toString(16) : e.toString(16)
  }

  function ja(e, t) {
    var n;
    t = t || Infinity;
    for (var r = e.length, o = null, i = [], s = 0; s < r; ++s) {
      if ((n = e.charCodeAt(s)) > 55295 && n < 57344) {
        if (!o) {
          if (n > 56319) {
            (t -= 3) > -1 && i.push(239, 191, 189);
            continue
          }
          if (s + 1 === r) {
            (t -= 3) > -1 && i.push(239, 191, 189);
            continue
          }
          o = n;
          continue
        }
        if (n < 56320) {
          (t -= 3) > -1 && i.push(239, 191, 189), o = n;
          continue
        }
        n = 65536 + (o - 55296 << 10 | n - 56320)
      } else o && (t -= 3) > -1 && i.push(239, 191, 189);
      if (o = null, n < 128) {
        if ((t -= 1) < 0) break;
        i.push(n)
      } else if (n < 2048) {
        if ((t -= 2) < 0) break;
        i.push(n >> 6 | 192, 63 & n | 128)
      } else if (n < 65536) {
        if ((t -= 3) < 0) break;
        i.push(n >> 12 | 224, n >> 6 & 63 | 128, 63 & n | 128)
      } else {
        if (!(n < 1114112)) throw new Error("Invalid code point");
        if ((t -= 4) < 0) break;
        i.push(n >> 18 | 240, n >> 12 & 63 | 128, n >> 6 & 63 | 128, 63 & n | 128)
      }
    }
    return i
  }

  function $a(e) {
    return function (e) {
      var t, n, r, o, i, s;
      na || ra();
      var a = e.length;
      if (a % 4 > 0) throw new Error("Invalid string. Length must be a multiple of 4");
      i = "=" === e[a - 2] ? 2 : "=" === e[a - 1] ? 1 : 0, s = new ta(3 * a / 4 - i), r = i > 0 ? a - 4 : a;
      var u = 0;
      for (t = 0, n = 0; t < r; t += 4, n += 3) o = ea[e.charCodeAt(t)] << 18 | ea[e.charCodeAt(t + 1)] << 12 | ea[e.charCodeAt(t + 2)] << 6 | ea[e.charCodeAt(t + 3)], s[u++] = o >> 16 & 255, s[u++] = o >> 8 & 255, s[u++] = 255 & o;
      return 2 === i ? (o = ea[e.charCodeAt(t)] << 2 | ea[e.charCodeAt(t + 1)] >> 4, s[u++] = 255 & o) : 1 === i && (o = ea[e.charCodeAt(t)] << 10 | ea[e.charCodeAt(t + 1)] << 4 | ea[e.charCodeAt(t + 2)] >> 2, s[u++] = o >> 8 & 255, s[u++] = 255 & o), s
    }(function (e) {
      if ((e = function (e) {
        return e.trim ? e.trim() : e.replace(/^\s+|\s+$/g, "")
      }(e).replace(Ka, "")).length < 2) return "";
      for (; e.length % 4 != 0;) e += "=";
      return e
    }(e))
  }

  function Ya(e, t, n, r) {
    for (var o = 0; o < r && !(o + n >= t.length || o >= e.length); ++o) t[o + n] = e[o];
    return o
  }

  function za(e) {
    return !!e.constructor && "function" == typeof e.constructor.isBuffer && e.constructor.isBuffer(e)
  }

  var Wa = function (e) {
      function t() {
        var e;
        return r(this, t), (e = m(this, l(t).call(this))).retry = 2, e._request = e.promisify(wx.request), e
      }

      return c(t, e), i(t, [{
        key: "request", value: function (e) {
          return this._checkOptions(e), this._initOptions(e), e = u({}, e, {responseType: "text"}), this._requestWithRetry(e)
        }
      }, {
        key: "_requestWithRetry", value: function (e) {
          var t = this, n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0;
          return this._request(e).then(this._handleResolve).catch((function (r) {
            if (J(r.errMsg)) {
              if (r.errMsg.includes("abort")) return Qo({});
              if (r.errMsg.includes("timeout")) return t.retry > 0 && n < t.retry ? t._requestWithRetry(e, ++n) : Zo(new lt({
                code: cn,
                message: r.errMsg
              }));
              if (r.errMsg.includes("fail")) return t.retry > 0 && n < t.retry ? t._requestWithRetry(e, ++n) : Zo(new lt({
                code: un,
                message: r.errMsg
              }))
            }
            return Zo(new lt(u({code: yn, message: r.message}, r)))
          }))
        }
      }, {
        key: "_handleResolve", value: function (e) {
          var t = e.data, n = t.error_code, r = t.ErrorCode;
          return "number" == typeof n && (r = n), r !== Re.SUCCESS && (e.data.ErrorCode = Number("".concat(r))), e
        }
      }, {
        key: "promisify", value: function (e) {
          return function (t) {
            return new Promise((function (n, r) {
              var o = e(Object.assign({}, t, {success: n, fail: r}));
              t.updateAbort && t.updateAbort((function () {
                o && re(o.abort) && o.abort()
              }))
            }))
          }
        }
      }]), t
    }(Js), Xa = function () {
      function e() {
        r(this, e), this.request = 0, this.success = 0, this.fail = 0, this.reportRate = 10, this.requestTimeCost = []
      }

      return i(e, [{
        key: "report", value: function () {
          if (1 !== this.request) {
            if (this.request % this.reportRate != 0) return null;
            var e = this.avgRequestTime(),
              t = "runLoop reports: success=".concat(this.success, ",fail=").concat(this.fail, ",total=").concat(this.request, ",avg=").concat(e, ",cur=").concat(this.requestTimeCost[this.requestTimeCost.length - 1], ",max=").concat(Math.max.apply(null, this.requestTimeCost), ",min=").concat(Math.min.apply(null, this.requestTimeCost));
            z.log(t)
          }
        }
      }, {
        key: "setRequestTime", value: function (e, t) {
          var n = Math.abs(t - e);
          100 === this.requestTimeCost.length && this.requestTimeCost.shift(), this.requestTimeCost.push(n)
        }
      }, {
        key: "avgRequestTime", value: function () {
          for (var e, t = this.requestTimeCost.length, n = 0, r = 0; r < t; r++) n += this.requestTimeCost[r];
          return e = n / t, Math.round(100 * e) / 100
        }
      }]), e
    }(), Ja = Ws.CancelToken, Qa = function () {
      function e(t) {
        r(this, e), this._initializeOptions(t), this._initializeMembers(), this.status = new Xa
      }

      return i(e, [{
        key: "destructor", value: function () {
          clearTimeout(this._seedID);
          var e = this._index();
          for (var t in this) Object.prototype.hasOwnProperty.call(this, t) && (this[t] = null);
          return e
        }
      }, {
        key: "setIndex", value: function (e) {
          this._index = e
        }
      }, {
        key: "getIndex", value: function () {
          return this._index
        }
      }, {
        key: "isRunning", value: function () {
          return !this._stoped
        }
      }, {
        key: "_initializeOptions", value: function (e) {
          this.options = e
        }
      }, {
        key: "_initializeMembers", value: function () {
          this._index = -1, this._seedID = 0, this._requestStatus = !1, this._stoped = !1, this._intervalTime = 0, this._intervalIncreaseStep = 1e3, this._intervalDecreaseStep = 1e3, this._intervalTimeMax = 5e3, this._protectTimeout = 3e3, this._getNoticeSeq = this.options.getNoticeSeq, this._retryCount = 0, this._responseTime = Date.now(), this._responseTimeThreshold = 2e3, this.requestor = Xs, this.abort = null
        }
      }, {
        key: "start", value: function () {
          0 === this._seedID ? (this._stoped = !1, this._send()) : z.log('XHRRunLoop.start(), XHRRunLoop is running now, if you want to restart runLoop , please run "stop()" first.')
        }
      }, {
        key: "_reset", value: function () {
          z.log("XHRRunLoop._reset(), reset long poll _intervalTime", this._intervalTime), this.stop(), this.start()
        }
      }, {
        key: "_intervalTimeIncrease", value: function () {
          this._intervalTime !== this._responseTimeThreshold && (this._intervalTime < this._responseTimeThreshold && (this._intervalTime += this._intervalIncreaseStep), this._intervalTime > this._responseTimeThreshold && (this._intervalTime = this._responseTimeThreshold))
        }
      }, {
        key: "_intervalTimeDecrease", value: function () {
          0 !== this._intervalTime && (this._intervalTime > 0 && (this._intervalTime -= this._intervalDecreaseStep), this._intervalTime < 0 && (this._intervalTime = 0))
        }
      }, {
        key: "_intervalTimeAdjustment", value: function () {
          var e = Date.now();
          100 * Math.floor((e - this._responseTime) / 100) <= this._responseTimeThreshold ? this._intervalTimeIncrease() : this._intervalTimeDecrease(), this._responseTime = e
        }
      }, {
        key: "_intervalTimeAdjustmentBaseOnResponseData", value: function (e) {
          e.ErrorCode === Re.SUCCESS ? this._intervalTimeDecrease() : this._intervalTimeIncrease()
        }
      }, {
        key: "_send", value: function () {
          var e = this;
          if (!0 !== this._requestStatus) {
            this._requestStatus = !0, this.status.request++, "function" == typeof this.options.before && this.options.before(this.options.pack.requestData);
            var t = Date.now(), n = 0;
            this.requestor.request({
              url: this.options.pack.getUrl(),
              data: this.options.pack.requestData,
              method: this.options.pack.method,
              cancelToken: new Ja((function (t) {
                e.abort = t
              }))
            }).then((function (r) {
              if (e._intervalTimeAdjustmentBaseOnResponseData.bind(e)(r.data), e._retryCount > 0 && (e._retryCount = 0), e.status.success++, n = Date.now(), e.status.setRequestTime(t, n), r.data.timecost = n - t, "function" == typeof e.options.success) try {
                e.options.success({pack: e.options.pack, error: !1, data: e.options.pack.callback(r.data)})
              } catch (o) {
                z.warn("XHRRunLoop._send(), error:", o)
              }
              e._requestStatus = !1, !1 === e._stoped && (e._seedID = setTimeout(e._send.bind(e), e._intervalTime)), e.status.report()
            })).catch((function (r) {
              if (e.status.fail++, e._retryCount++, e._intervalTimeAdjustment.bind(e)(), !1 === e._stoped && (e._seedID = setTimeout(e._send.bind(e), e._intervalTime)), e._requestStatus = !1, "function" == typeof e.options.fail && void 0 !== r.request) try {
                e.options.fail({pack: e.options.pack, error: r, data: !1})
              } catch (o) {
                z.warn("XHRRunLoop._send(), fail callback error:"), z.error(o)
              }
              n = Date.now(), e.status.setRequestTime(t, n), e.status.report()
            }))
          }
        }
      }, {
        key: "stop", value: function () {
          this._clearAllTimeOut(), this._stoped = !0
        }
      }, {
        key: "_clearAllTimeOut", value: function () {
          clearTimeout(this._seedID), this._seedID = 0
        }
      }]), e
    }(), Za = function () {
      function e(t) {
        r(this, e), this._initializeOptions(t), this._initializeMembers(), this.status = new Xa
      }

      return i(e, [{
        key: "destructor", value: function () {
          clearTimeout(this._seedID);
          var e = this._index();
          for (var t in this) Object.prototype.hasOwnProperty.call(this, t) && (this[t] = null);
          return e
        }
      }, {
        key: "setIndex", value: function (e) {
          this._index = e
        }
      }, {
        key: "isRunning", value: function () {
          return !this._stoped
        }
      }, {
        key: "getIndex", value: function () {
          return this._index
        }
      }, {
        key: "_initializeOptions", value: function (e) {
          this.options = e
        }
      }, {
        key: "_initializeMembers", value: function () {
          this._index = -1, this._seedID = 0, this._requestStatus = !1, this._stoped = !1, this._intervalTime = 0, this._intervalIncreaseStep = 1e3, this._intervalDecreaseStep = 1e3, this._intervalTimeMax = 5e3, this._protectTimeout = 3e3, this._getNoticeSeq = this.options.getNoticeSeq, this._retryCount = 0, this._responseTime = Date.now(), this._responseTimeThreshold = 2e3, this.requestor = new Wa, this.abort = null
        }
      }, {
        key: "start", value: function () {
          0 === this._seedID ? (this._stoped = !1, this._send()) : z.log('WXRunLoop.start(): WXRunLoop is running now, if you want to restart runLoop , please run "stop()" first.')
        }
      }, {
        key: "_reset", value: function () {
          z.log("WXRunLoop.reset(), long poll _intervalMaxRate", this._intervalMaxRate), this.stop(), this.start()
        }
      }, {
        key: "_intervalTimeIncrease", value: function () {
          this._intervalTime !== this._responseTimeThreshold && (this._intervalTime < this._responseTimeThreshold && (this._intervalTime += this._intervalIncreaseStep), this._intervalTime > this._responseTimeThreshold && (this._intervalTime = this._responseTimeThreshold))
        }
      }, {
        key: "_intervalTimeDecrease", value: function () {
          0 !== this._intervalTime && (this._intervalTime > 0 && (this._intervalTime -= this._intervalDecreaseStep), this._intervalTime < 0 && (this._intervalTime = 0))
        }
      }, {
        key: "_intervalTimeAdjustment", value: function () {
          var e = Date.now();
          100 * Math.floor((e - this._responseTime) / 100) <= this._responseTimeThreshold ? this._intervalTimeIncrease() : this._intervalTimeDecrease(), this._responseTime = e
        }
      }, {
        key: "_intervalTimeAdjustmentBaseOnResponseData", value: function (e) {
          e.ErrorCode === Re.SUCCESS ? this._intervalTimeDecrease() : this._intervalTimeIncrease()
        }
      }, {
        key: "_send", value: function () {
          var e = this;
          if (!0 !== this._requestStatus) {
            var t = this;
            this._requestStatus = !0, this.status.request++, "function" == typeof this.options.before && this.options.before(t.options.pack.requestData);
            var n = Date.now(), r = 0;
            this.requestor.request({
              url: t.options.pack.getUrl(),
              data: t.options.pack.requestData,
              method: t.options.pack.method,
              updateAbort: function (t) {
                e.abort = t
              }
            }).then((function (o) {
              if (t._intervalTimeAdjustmentBaseOnResponseData.bind(e)(o.data), t._retryCount > 0 && (t._retryCount = 0), e.status.success++, r = Date.now(), e.status.setRequestTime(n, r), o.data.timecost = r - n, "function" == typeof t.options.success) try {
                e.options.success({pack: e.options.pack, error: !1, data: e.options.pack.callback(o.data)})
              } catch (i) {
                z.warn("WXRunLoop._send(), error:", i)
              }
              t._requestStatus = !1, !1 === t._stoped && (t._seedID = setTimeout(t._send.bind(t), t._intervalTime)), e.status.report()
            })).catch((function (o) {
              if (e.status.fail++, t._retryCount++, t._intervalTimeAdjustment.bind(e)(), !1 === t._stoped && (t._seedID = setTimeout(t._send.bind(t), t._intervalTime)), t._requestStatus = !1, "function" == typeof t.options.fail) try {
                e.options.fail({pack: e.options.pack, error: o, data: !1})
              } catch (i) {
                z.warn("WXRunLoop._send(), fail callback error:"), z.error(i)
              }
              r = Date.now(), e.status.setRequestTime(n, r), e.status.report()
            }))
          }
        }
      }, {
        key: "stop", value: function () {
          this._clearAllTimeOut(), this._stoped = !0
        }
      }, {
        key: "_clearAllTimeOut", value: function () {
          clearTimeout(this._seedID), this._seedID = 0
        }
      }]), e
    }(), eu = function (e) {
      function t(e) {
        var n;
        return r(this, t), (n = m(this, l(t).call(this, e))).context = e.context, n.httpConnection = n._getHttpconnection(), n.keepAliveConnections = [], n
      }

      return c(t, e), i(t, [{
        key: "initializeListener", value: function () {
          this.tim.innerEmitter.on(Ro, this._stopAllRunLoop, this)
        }
      }, {
        key: "request", value: function (e) {
          var t = {url: e.url, data: e.requestData, method: e.method, callback: e.callback};
          return this.httpConnection.request(t).then((function (t) {
            return t.data = e.callback(t.data), t.data.errorCode !== Re.SUCCESS ? Zo(new lt({
              code: t.data.errorCode,
              message: t.data.errorInfo
            })) : t
          }))
        }
      }, {
        key: "createRunLoop", value: function (e) {
          var t = this.createKeepAliveConnection(e);
          return t.setIndex(this.keepAliveConnections.push(t) - 1), t
        }
      }, {
        key: "stopRunLoop", value: function (e) {
          e.stop()
        }
      }, {
        key: "_stopAllRunLoop", value: function () {
          for (var e = this.keepAliveConnections.length, t = 0; t < e; t++) this.keepAliveConnections[t].stop()
        }
      }, {
        key: "destroyRunLoop", value: function (e) {
          e.stop();
          var t = e.destructor();
          this.keepAliveConnections.slice(t, 1)
        }
      }, {
        key: "startRunLoopExclusive", value: function (e) {
          for (var t = e.getIndex(), n = 0; n < this.keepAliveConnections.length; n++) n !== t && this.keepAliveConnections[n].stop();
          e.start()
        }
      }, {
        key: "_getHttpconnection", value: function () {
          return E ? new Wa : new Qs
        }
      }, {
        key: "createKeepAliveConnection", value: function (e) {
          return E ? new Za(e) : this.tim.options.runLoopNetType === We ? new Qa(e) : (this.tim.options.runLoopNetType, new Qa(e))
        }
      }, {
        key: "clearAll", value: function () {
          this.conn.cancelAll()
        }
      }, {
        key: "reset", value: function () {
          this.keepAliveConnections = []
        }
      }]), t
    }($o), tu = function () {
      function t(e) {
        r(this, t), this.tim = e, this.tim.innerEmitter.on(bo, this._onErrorDetected, this)
      }

      return i(t, [{
        key: "_onErrorDetected", value: function (t) {
          t.code ? z.warn("Oops! code:".concat(t.code, " message:").concat(t.message)) : z.warn("Oops! message:".concat(t.message, " stack:").concat(t.stack)), this.tim.outerEmitter.emit(e.ERROR, t)
        }
      }]), t
    }(), nu = function () {
      function e(n) {
        var o = this;
        r(this, e), Te(n) || (this.userID = n.userID || "", this.nick = n.nick || "", this.gender = n.gender || "", this.birthday = n.birthday || 0, this.location = n.location || "", this.selfSignature = n.selfSignature || "", this.allowType = n.allowType || t.ALLOW_TYPE_ALLOW_ANY, this.language = n.language || 0, this.avatar = n.avatar || "", this.messageSettings = n.messageSettings || 0, this.adminForbidType = n.adminForbidType || t.FORBID_TYPE_NONE, this.level = n.level || 0, this.role = n.role || 0, this.lastUpdatedTime = 0, this.profileCustomField = [], Te(n.profileCustomField) || n.profileCustomField.forEach((function (e) {
          o.profileCustomField.push({key: e.key, value: e.value})
        })))
      }

      return i(e, [{
        key: "validate", value: function (e) {
          var t = !0, n = "";
          if (Te(e)) return {valid: !1, tips: "empty options"};
          if (e.profileCustomField) for (var r = e.profileCustomField.length, o = null, i = 0; i < r; i++) {
            if (o = e.profileCustomField[i], !J(o.key) || -1 === o.key.indexOf("Tag_Profile_Custom")) return {
              valid: !1,
              tips: "自定义资料字段的前缀必须是 Tag_Profile_Custom"
            };
            if (!J(o.value)) return {valid: !1, tips: "自定义资料字段的 value 必须是字符串"}
          }
          for (var s in e) if (Object.prototype.hasOwnProperty.call(e, s)) {
            if ("profileCustomField" === s) continue;
            if (Te(e[s]) && !J(e[s]) && !X(e[s])) {
              n = "key:" + s + ", invalid value:" + e[s], t = !1;
              continue
            }
            switch (s) {
              case"nick":
                J(e[s]) || (n = "nick should be a string", t = !1), he(e[s]) > 500 && (n = "nick name limited: must less than or equal to ".concat(500, " bytes, current size: ").concat(he(e[s]), " bytes"), t = !1);
                break;
              case"gender":
                me(Ze, e.gender) || (n = "key:gender, invalid value:" + e.gender, t = !1);
                break;
              case"birthday":
                X(e.birthday) || (n = "birthday should be a number", t = !1);
                break;
              case"location":
                J(e.location) || (n = "location should be a string", t = !1);
                break;
              case"selfSignature":
                J(e.selfSignature) || (n = "selfSignature should be a string", t = !1);
                break;
              case"allowType":
                me(tt, e.allowType) || (n = "key:allowType, invalid value:" + e.allowType, t = !1);
                break;
              case"language":
                X(e.language) || (n = "language should be a number", t = !1);
                break;
              case"avatar":
                J(e.avatar) || (n = "avatar should be a string", t = !1);
                break;
              case"messageSettings":
                0 !== e.messageSettings && 1 !== e.messageSettings && (n = "messageSettings should be 0 or 1", t = !1);
                break;
              case"adminForbidType":
                me(et, e.adminForbidType) || (n = "key:adminForbidType, invalid value:" + e.adminForbidType, t = !1);
                break;
              case"level":
                X(e.level) || (n = "level should be a number", t = !1);
                break;
              case"role":
                X(e.role) || (n = "role should be a number", t = !1);
                break;
              default:
                n = "unknown key:" + s + "  " + e[s], t = !1
            }
          }
          return {valid: t, tips: n}
        }
      }]), e
    }(), ru = function () {
      function t(e) {
        r(this, t), this.uc = e, this.TAG = "profile", this.Actions = {
          Q: "query",
          U: "update"
        }, this.accountProfileMap = new Map, this.expirationTime = 864e5
      }

      return i(t, [{
        key: "setExpirationTime", value: function (e) {
          this.expirationTime = e
        }
      }, {
        key: "getUserProfile", value: function (e) {
          var t = this, n = this.uc.tim.connectionController, r = e.userIDList;
          e.fromAccount = this.uc.getMyAccount(), r.length > 100 && (z.warn("ProfileHandler.getUserProfile 获取用户资料人数不能超过100人"), r.length = 100);
          for (var o, i = [], s = [], a = 0, u = r.length; a < u; a++) o = r[a], this.uc.isMyFriend(o) && this._containsAccount(o) ? s.push(this._getProfileFromMap(o)) : i.push(o);
          if (0 === i.length) return Qo(s);
          e.toAccount = i;
          var c = e.bFromGetMyProfile || !1, l = [];
          e.toAccount.forEach((function (e) {
            l.push({toAccount: e, standardSequence: 0, customSequence: 0})
          })), e.userItem = l;
          var p = new ui;
          p.setMethod(Ui).setStart();
          var h = this.uc.makeCapsule(this.TAG, this.Actions.Q, e);
          return n.request(h).then((function (e) {
            p.setCode(0).setNetworkType(t.uc.getNetworkType()).setText(e.data.userProfileItem.length).setEnd(), z.info("ProfileHandler.getUserProfile ok");
            var n = t._handleResponse(e).concat(s);
            return c ? (t.uc.onGotMyProfile(), new Wo(n[0])) : new Wo(n)
          })).catch((function (e) {
            return t.uc.probeNetwork().then((function (t, n) {
              p.setError(e, t, n).setEnd()
            })), z.error("ProfileHandler.getUserProfile error:", e), Zo(e)
          }))
        }
      }, {
        key: "getMyProfile", value: function () {
          var e = this.uc.getMyAccount();
          if (z.log("ProfileHandler.getMyProfile myAccount=" + e), this._fillMap(), this._containsAccount(e)) {
            var t = this._getProfileFromMap(e);
            return z.debug("ProfileHandler.getMyProfile from cache, myProfile:" + JSON.stringify(t)), this.uc.onGotMyProfile(), Qo(t)
          }
          return this.getUserProfile({fromAccount: e, userIDList: [e], bFromGetMyProfile: !0})
        }
      }, {
        key: "_handleResponse", value: function (e) {
          for (var t, n, r = ue.now(), o = e.data.userProfileItem, i = [], s = 0, a = o.length; s < a; s++) "@TLS#NOT_FOUND" !== o[s].to && "" !== o[s].to && (t = o[s].to, n = this._updateMap(t, this._getLatestProfileFromResponse(t, o[s].profileItem)), i.push(n));
          return z.log("ProfileHandler._handleResponse cost " + (ue.now() - r) + " ms"), i
        }
      }, {
        key: "_getLatestProfileFromResponse", value: function (e, t) {
          var n = {};
          if (n.userID = e, n.profileCustomField = [], !Te(t)) for (var r = 0, o = t.length; r < o; r++) if (t[r].tag.indexOf("Tag_Profile_Custom") > -1) n.profileCustomField.push({
            key: t[r].tag,
            value: t[r].value
          }); else switch (t[r].tag) {
            case Qe.NICK:
              n.nick = t[r].value;
              break;
            case Qe.GENDER:
              n.gender = t[r].value;
              break;
            case Qe.BIRTHDAY:
              n.birthday = t[r].value;
              break;
            case Qe.LOCATION:
              n.location = t[r].value;
              break;
            case Qe.SELFSIGNATURE:
              n.selfSignature = t[r].value;
              break;
            case Qe.ALLOWTYPE:
              n.allowType = t[r].value;
              break;
            case Qe.LANGUAGE:
              n.language = t[r].value;
              break;
            case Qe.AVATAR:
              n.avatar = t[r].value;
              break;
            case Qe.MESSAGESETTINGS:
              n.messageSettings = t[r].value;
              break;
            case Qe.ADMINFORBIDTYPE:
              n.adminForbidType = t[r].value;
              break;
            case Qe.LEVEL:
              n.level = t[r].value;
              break;
            case Qe.ROLE:
              n.role = t[r].value;
              break;
            default:
              z.warn("ProfileHandler._handleResponse unkown tag->", t[r].tag, t[r].value)
          }
          return n
        }
      }, {
        key: "updateMyProfile", value: function (t) {
          var n = this, r = this.uc.tim, o = r.connectionController, i = r.outerEmitter, s = (new nu).validate(t);
          if (!s.valid) return z.error("ProfileHandler.updateMyProfile info:".concat(s.tips, "，请参考 https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/SDK.html#updateMyProfile")), Zo({
            code: nn,
            message: dr
          });
          var a = [];
          for (var u in t) Object.prototype.hasOwnProperty.call(t, u) && ("profileCustomField" === u ? t.profileCustomField.forEach((function (e) {
            a.push({tag: e.key, value: e.value})
          })) : a.push({tag: Qe[u.toUpperCase()], value: t[u]}));
          if (0 === a.length) return z.error("ProfileHandler.updateMyProfile info:".concat(mr, "，请参考 https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/SDK.html#updateMyProfile")), Zo({
            code: rn,
            message: mr
          });
          var c = this.uc.makeCapsule(this.TAG, this.Actions.U, {fromAccount: this.uc.getMyAccount(), profileItem: a});
          return o.request(c).then((function (r) {
            z.info("ProfileHandler.updateMyProfile ok");
            var o = n._updateMap(n.uc.getMyAccount(), t);
            return i.emit(e.PROFILE_UPDATED, [o]), Qo(o)
          })).catch((function (e) {
            return z.error("ProfileHandler.updateMyProfile error:", e), Zo(e)
          }))
        }
      }, {
        key: "onProfileModified", value: function (t) {
          var n = t.data;
          if (!Te(n)) {
            var r, o, i = n.length;
            z.info("ProfileHandler.onProfileModified length=" + i);
            for (var s = [], a = 0; a < i; a++) r = n[a].userID, o = this._updateMap(r, this._getLatestProfileFromResponse(r, n[a].profileList)), s.push(o);
            var u = this.uc.tim, c = u.innerEmitter, l = u.outerEmitter;
            c.emit(Uo, {data: s}), l.emit(e.PROFILE_UPDATED, s)
          }
        }
      }, {
        key: "_fillMap", value: function () {
          if (0 === this.accountProfileMap.size) {
            for (var e = this._getCachedProfiles(), t = Date.now(), n = 0, r = e.length; n < r; n++) t - e[n].lastUpdatedTime < this.expirationTime && this.accountProfileMap.set(e[n].userID, e[n]);
            z.log("ProfileHandler._fillMap from cache, map.size=" + this.accountProfileMap.size)
          }
        }
      }, {
        key: "_updateMap", value: function (e, t) {
          var n, r = Date.now();
          return this._containsAccount(e) ? (n = this._getProfileFromMap(e), t.profileCustomField && Me(n.profileCustomField, t.profileCustomField), ce(n, t, ["profileCustomField"]), n.lastUpdatedTime = r) : (n = new nu(t), (this.uc.isMyFriend(e) || e === this.uc.getMyAccount()) && (n.lastUpdatedTime = r, this.accountProfileMap.set(e, n))), this._flushMap(e === this.uc.getMyAccount()), n
        }
      }, {
        key: "_flushMap", value: function (e) {
          var t = v(this.accountProfileMap.values()), n = this.uc.tim.storage;
          z.debug("ProfileHandler._flushMap length=".concat(t.length, " flushAtOnce=").concat(e)), n.setItem(this.TAG, t, e)
        }
      }, {
        key: "_containsAccount", value: function (e) {
          return this.accountProfileMap.has(e)
        }
      }, {
        key: "_getProfileFromMap", value: function (e) {
          return this.accountProfileMap.get(e)
        }
      }, {
        key: "_getCachedProfiles", value: function () {
          var e = this.uc.tim.storage.getItem(this.TAG);
          return Te(e) ? [] : e
        }
      }, {
        key: "onConversationsProfileUpdated", value: function (e) {
          for (var t, n, r, o = [], i = 0, s = e.length; i < s; i++) n = (t = e[i]).userID, this.uc.isMyFriend(n) && (this._containsAccount(n) ? (r = this._getProfileFromMap(n), ce(r, t) > 0 && o.push(n)) : o.push(t.userID));
          0 !== o.length && (z.info("ProfileHandler.onConversationsProfileUpdated toAccount:", o), this.getUserProfile({userIDList: o}))
        }
      }, {
        key: "reset", value: function () {
          this._flushMap(!0), this.accountProfileMap.clear()
        }
      }]), t
    }(), ou = function () {
      function e(t) {
        r(this, e), this.options = t ? t.options : {enablePointer: !0}, this.pointsList = {}, this.reportText = {}, this.maxNameLen = 0, this.gapChar = "-", this.log = console.log, this.currentTask = ""
      }

      return i(e, [{
        key: "newTask", value: function (e) {
          !1 !== this.options.enablePointer && (e || (e = ["task", this._timeFormat()].join("-")), this.pointsList[e] = [], this.currentTask = e, console.log("Pointer new Task : ".concat(this.currentTask)))
        }
      }, {
        key: "deleteTask", value: function (e) {
          !1 !== this.options.enablePointer && (e || (e = this.currentTask), this.pointsList[e].length = 0, delete this.pointsList[e])
        }
      }, {
        key: "dot", value: function () {
          var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "",
            t = arguments.length > 1 ? arguments[1] : void 0;
          if (!1 !== this.options.enablePointer) {
            t = t || this.currentTask;
            var n = +new Date;
            this.maxNameLen = this.maxNameLen < e.length ? e.length : this.maxNameLen, this.flen = this.maxNameLen + 10, this.pointsList[t].push({
              pointerName: e,
              time: n
            })
          }
        }
      }, {
        key: "_analisys", value: function (e) {
          if (!1 !== this.options.enablePointer) {
            e = e || this.currentTask;
            for (var t = this.pointsList[e], n = t.length, r = [], o = [], i = 0; i < n; i++) 0 !== i && (o = this._analisysTowPoints(t[i - 1], t[i]), r.push(o.join("")));
            return o = this._analisysTowPoints(t[0], t[n - 1], !0), r.push(o.join("")), r.join("")
          }
        }
      }, {
        key: "_analisysTowPoints", value: function (e, t) {
          var n = arguments.length > 2 && void 0 !== arguments[2] && arguments[2];
          if (!1 !== this.options.enablePointer) {
            var r = this.flen, o = t.time - e.time, i = o.toString(),
              s = e.pointerName + this.gapChar.repeat(r - e.pointerName.length),
              a = t.pointerName + this.gapChar.repeat(r - t.pointerName.length),
              u = this.gapChar.repeat(4 - i.length) + i, c = n ? ["%c", s, a, u, "ms\n%c"] : [s, a, u, "ms\n"];
            return c
          }
        }
      }, {
        key: "report", value: function (e) {
          if (!1 !== this.options.enablePointer) {
            e = e || this.currentTask;
            var t = this._analisys(e);
            this.pointsList = [];
            var n = this._timeFormat(), r = "Pointer[".concat(e, "(").concat(n, ")]"), o = 4 * this.maxNameLen,
              i = (o - r.length) / 2;
            console.log(["-".repeat(i), r, "-".repeat(i)].join("")), console.log("%c" + t, "color:#66a", "color:red", "color:#66a"), console.log("-".repeat(o))
          }
        }
      }, {
        key: "_timeFormat", value: function () {
          var e = new Date, t = this.zeroFix(e.getMonth() + 1, 2), n = this.zeroFix(e.getDate(), 2);
          return "".concat(t, "-").concat(n, " ").concat(e.getHours(), ":").concat(e.getSeconds(), ":").concat(e.getMinutes(), "~").concat(e.getMilliseconds())
        }
      }, {
        key: "zeroFix", value: function (e, t) {
          return ("000000000" + e).slice(-t)
        }
      }, {
        key: "reportAll", value: function () {
          if (!1 !== this.options.enablePointer) for (var e in this.pointsList) Object.prototype.hasOwnProperty.call(this.pointsList, e) && this.eport(e)
        }
      }]), e
    }(), iu = function e(t, n) {
      r(this, e), this.userID = t;
      var o = {};
      if (o.userID = t, !Te(n)) for (var i = 0, s = n.length; i < s; i++) switch (n[i].tag) {
        case Qe.NICK:
          o.nick = n[i].value;
          break;
        case Qe.GENDER:
          o.gender = n[i].value;
          break;
        case Qe.BIRTHDAY:
          o.birthday = n[i].value;
          break;
        case Qe.LOCATION:
          o.location = n[i].value;
          break;
        case Qe.SELFSIGNATURE:
          o.selfSignature = n[i].value;
          break;
        case Qe.ALLOWTYPE:
          o.allowType = n[i].value;
          break;
        case Qe.LANGUAGE:
          o.language = n[i].value;
          break;
        case Qe.AVATAR:
          o.avatar = n[i].value;
          break;
        case Qe.MESSAGESETTINGS:
          o.messageSettings = n[i].value;
          break;
        case Qe.ADMINFORBIDTYPE:
          o.adminForbidType = n[i].value;
          break;
        case Qe.LEVEL:
          o.level = n[i].value;
          break;
        case Qe.ROLE:
          o.role = n[i].value;
          break;
        default:
          z.debug("snsProfileItem unkown tag->", n[i].tag)
      }
      this.profile = new nu(o)
    }, su = function () {
      function e(t) {
        r(this, e), this.uc = t, this.TAG = "friend", this.Actions = {
          G: "get",
          D: "delete"
        }, this.friends = new Map, this.pointer = new ou
      }

      return i(e, [{
        key: "isMyFriend", value: function (e) {
          var t = this.friends.has(e);
          return t || z.debug("FriendHandler.isMyFriend " + e + " is not my friend"), t
        }
      }, {
        key: "_transformFriendList", value: function (e) {
          if (!Te(e) && !Te(e.infoItem)) {
            z.info("FriendHandler._transformFriendList friendNum=" + e.friendNum);
            for (var t, n, r = e.infoItem, o = 0, i = r.length; o < i; o++) n = r[o].infoAccount, t = new iu(n, r[o].snsProfileItem), this.friends.set(n, t)
          }
        }
      }, {
        key: "_friends2map", value: function (e) {
          var t = new Map;
          for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t.set(n, e[n]);
          return t
        }
      }, {
        key: "getFriendList", value: function () {
          var e = this, t = this.uc.tim.connectionController, n = {};
          n.fromAccount = this.uc.getMyAccount(), z.info("FriendHandler.getFriendList myAccount=" + n.fromAccount);
          var r = this.uc.makeCapsule(this.TAG, this.Actions.G, n);
          return t.request(r).then((function (t) {
            z.info("FriendHandler.getFriendList ok"), e._transformFriendList(t.data);
            var n = v(e.friends.values());
            return Qo(n)
          })).catch((function (e) {
            return z.error("FriendHandler.getFriendList error:", JSON.stringify(e)), Zo(e)
          }))
        }
      }, {
        key: "deleteFriend", value: function (e) {
          if (!Array.isArray(e.toAccount)) return z.error("FriendHandler.deleteFriend options.toAccount 必需是数组"), Zo({
            code: tn,
            message: gr
          });
          e.toAccount.length > 1e3 && (z.warn("FriendHandler.deleteFriend 删除好友人数不能超过1000人"), e.toAccount.length = 1e3);
          var t = this.uc.tim.connectionController, n = this.uc.makeCapsule(this.TAG, this.Actions.D, e);
          return t.request(n).then((function (e) {
            return z.info("FriendHandler.deleteFriend ok"), Qo()
          })).catch((function (e) {
            return z.error("FriendHandler.deleteFriend error:", e), Zo(e)
          }))
        }
      }]), e
    }(), au = function e(t) {
      r(this, e), Te || (this.userID = t.userID || "", this.timeStamp = t.timeStamp || 0)
    }, uu = function () {
      function t(e) {
        r(this, t), this.uc = e, this.TAG = "blacklist", this.Actions = {
          G: "get",
          C: "create",
          D: "delete"
        }, this.blacklistMap = new Map, this.startIndex = 0, this.maxLimited = 100, this.curruentSequence = 0
      }

      return i(t, [{
        key: "getBlacklist", value: function () {
          var e = this, t = this.uc.tim.connectionController, n = {};
          n.fromAccount = this.uc.getMyAccount(), n.maxLimited = this.maxLimited, n.startIndex = 0, n.lastSequence = this.curruentSequence;
          var r = new ui;
          r.setMethod(qi).setStart();
          var o = this.uc.makeCapsule(this.TAG, this.Actions.G, n);
          return t.request(o).then((function (t) {
            var n = Te(t.data.blackListItem) ? 0 : t.data.blackListItem.length;
            return r.setCode(0).setNetworkType(e.uc.getNetworkType()).setText(n).setEnd(), z.info("BlacklistHandler.getBlacklist ok"), e.curruentSequence = t.data.curruentSequence, e._handleResponse(t.data.blackListItem, !0), e._onBlacklistUpdated()
          })).catch((function (t) {
            return e.uc.probeNetwork().then((function (e, n) {
              r.setError(t, e, n).setEnd()
            })), z.error("BlacklistHandler.getBlacklist error:", t), Zo(t)
          }))
        }
      }, {
        key: "addBlacklist", value: function (e) {
          var t = this;
          if (!ee(e.userIDList)) return z.error("BlacklistHandler.addBlacklist options.userIDList 必需是数组"), Zo({
            code: on,
            message: yr
          });
          var n = this.uc.tim.loginInfo.identifier;
          if (1 === e.userIDList.length && e.userIDList[0] === n) return z.error("BlacklistHandler.addBlacklist 不能把自己拉黑"), Zo({
            code: an,
            message: _r
          });
          e.userIDList.includes(n) && (e.userIDList = e.userIDList.filter((function (e) {
            return e !== n
          })), z.warn("BlacklistHandler.addBlacklist 不能把自己拉黑，已过滤"));
          var r = this.uc.tim.connectionController;
          e.fromAccount = this.uc.getMyAccount(), e.toAccount = e.userIDList;
          var o = this.uc.makeCapsule(this.TAG, this.Actions.C, e);
          return r.request(o).then((function (e) {
            return z.info("BlacklistHandler.addBlacklist ok"), t._handleResponse(e.data.resultItem, !0), t._onBlacklistUpdated()
          })).catch((function (e) {
            return z.error("BlacklistHandler.addBlacklist error:", e), Zo(e)
          }))
        }
      }, {
        key: "_handleResponse", value: function (e, t) {
          if (!Te(e)) for (var n, r, o, i = 0, s = e.length; i < s; i++) r = e[i].to, o = e[i].resultCode, (te(o) || 0 === o) && (t ? ((n = this.blacklistMap.has(r) ? this.blacklistMap.get(r) : new au).userID = r, !Te(e[i].addBlackTimeStamp) && (n.timeStamp = e[i].addBlackTimeStamp), this.blacklistMap.set(r, n)) : this.blacklistMap.has(r) && (n = this.blacklistMap.get(r), this.blacklistMap.delete(r)));
          z.log("BlacklistHandler._handleResponse total=" + this.blacklistMap.size + " bAdd=" + t)
        }
      }, {
        key: "deleteBlacklist", value: function (e) {
          var t = this;
          if (!ee(e.userIDList)) return z.error("BlacklistHandler.deleteBlacklist options.userIDList 必需是数组"), Zo({
            code: sn,
            message: vr
          });
          var n = this.uc.tim.connectionController;
          e.fromAccount = this.uc.getMyAccount(), e.toAccount = e.userIDList;
          var r = this.uc.makeCapsule(this.TAG, this.Actions.D, e);
          return n.request(r).then((function (e) {
            return z.info("BlacklistHandler.deleteBlacklist ok"), t._handleResponse(e.data.resultItem, !1), t._onBlacklistUpdated()
          })).catch((function (e) {
            return z.error("BlacklistHandler.deleteBlacklist error:", e), Zo(e)
          }))
        }
      }, {
        key: "_onBlacklistUpdated", value: function () {
          var t = this.uc.tim.outerEmitter, n = v(this.blacklistMap.keys());
          return t.emit(e.BLACKLIST_UPDATED, n), Qo(n)
        }
      }, {
        key: "handleBlackListDelAccount", value: function (t) {
          for (var n, r = [], o = 0, i = t.length; o < i; o++) n = t[o], this.blacklistMap.has(n) && (this.blacklistMap.delete(n), r.push(n));
          r.length > 0 && (z.log("BlacklistHandler.handleBlackListDelAccount delCount=" + r.length + " : " + r.join(",")), this.tim.outerEmitter.emit(e.BLACKLIST_UPDATED, v(this.blacklistMap.keys())))
        }
      }, {
        key: "handleBlackListAddAccount", value: function (t) {
          for (var n, r = [], o = 0, i = t.length; o < i; o++) n = t[o], this.blacklistMap.has(n) || (this.blacklistMap.set(n, new au({userID: n})), r.push(n));
          r.length > 0 && (z.log("BlacklistHandler.handleBlackListAddAccount addCount=" + r.length + " : " + r.join(",")), this.tim.outerEmitter.emit(e.BLACKLIST_UPDATED, v(this.blacklistMap.keys())))
        }
      }, {
        key: "reset", value: function () {
          this.blacklistMap.clear(), this.startIndex = 0, this.maxLimited = 100, this.curruentSequence = 0
        }
      }]), t
    }(), cu = function () {
      function e(t) {
        r(this, e), this.uc = t, this.TAG = "applyC2C", this.Actions = {C: "create", G: "get", D: "delete", U: "update"}
      }

      return i(e, [{
        key: "applyAddFriend", value: function (e) {
          var t = this, n = this.uc.tim.connectionController, r = this.uc.makeCapsule(this.TAG, this.Actions.C, e),
            o = n.request(r);
          return o.then((function (e) {
            t.uc.isActionSuccessful("applyAddFriend", t.Actions.C, e)
          })).catch((function (e) {
          })), o
        }
      }, {
        key: "getPendency", value: function (e) {
          var t = this, n = this.tim.connectionController, r = this.uc.makeCapsule(this.TAG, this.Actions.G, e),
            o = n.request(r);
          return o.then((function (e) {
            t.uc.isActionSuccessful("getPendency", t.Actions.G, e)
          })).catch((function (e) {
          })), o
        }
      }, {
        key: "deletePendency", value: function (e) {
          var t = this, n = this.tim.connectionController, r = this.uc.makeCapsule(this.TAG, this.Actions.D, e),
            o = n.request(r);
          return o.then((function (e) {
            t.uc.isActionSuccessful("deletePendency", t.Actions.D, e)
          })).catch((function (e) {
          })), o
        }
      }, {
        key: "replyPendency", value: function () {
          var e = this, t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},
            n = this.tim.connectionController, r = this.uc.makeCapsule(this.TAG, this.Actions.U, t), o = n.request(r);
          return o.then((function (t) {
            e.uc.isActionSuccessful("replyPendency", e.Actions.U, t)
          })).catch((function (e) {
          })), o
        }
      }]), e
    }(), lu = function (e) {
      function t(e) {
        var n;
        return r(this, t), (n = m(this, l(t).call(this, e))).profileHandler = new ru(d(n)), n.friendHandler = new su(d(n)), n.blacklistHandler = new uu(d(n)), n.applyC2CHandler = new cu(d(n)), n._initializeListener(), n
      }

      return c(t, e), i(t, [{
        key: "_initializeListener", value: function (e) {
          var t = this.tim.innerEmitter;
          t.on(zr, this.onContextUpdated, this), t.on(Io, this.onProfileModified, this), t.on(Co, this.onNewFriendMessages, this), t.on(No, this.onConversationsProfileUpdated, this)
        }
      }, {
        key: "onContextUpdated", value: function (e) {
          var t = e.data.context;
          !1 != !!t.a2Key && !1 != !!t.tinyID && (this.profileHandler.getMyProfile(), this.friendHandler.getFriendList(), this.blacklistHandler.getBlacklist())
        }
      }, {
        key: "onGotMyProfile", value: function () {
          this.triggerReady()
        }
      }, {
        key: "onProfileModified", value: function (e) {
          this.profileHandler.onProfileModified(e)
        }
      }, {
        key: "onNewFriendMessages", value: function (e) {
          z.debug("onNewFriendMessages", JSON.stringify(e.data)), Te(e.data.blackListDelAccount) || this.blacklistHandler.handleBlackListDelAccount(e.data.blackListDelAccount), Te(e.data.blackListAddAccount) || this.blacklistHandler.handleBlackListAddAccount(e.data.blackListAddAccount)
        }
      }, {
        key: "onConversationsProfileUpdated", value: function (e) {
          this.profileHandler.onConversationsProfileUpdated(e.data)
        }
      }, {
        key: "getMyAccount", value: function () {
          return this.tim.context.identifier
        }
      }, {
        key: "isMyFriend", value: function (e) {
          return this.friendHandler.isMyFriend(e)
        }
      }, {
        key: "makeCapsule", value: function (e, t, n) {
          return this.createPackage({name: e, action: t, param: n})
        }
      }, {
        key: "getMyProfile", value: function () {
          return this.profileHandler.getMyProfile()
        }
      }, {
        key: "getUserProfile", value: function (e) {
          return this.profileHandler.getUserProfile(e)
        }
      }, {
        key: "updateMyProfile", value: function (e) {
          return this.profileHandler.updateMyProfile(e)
        }
      }, {
        key: "getFriendList", value: function () {
          return this.friendHandler.getFriendList()
        }
      }, {
        key: "deleteFriend", value: function (e) {
          return this.friendHandler.deleteFriend(e)
        }
      }, {
        key: "getBlacklist", value: function () {
          return this.blacklistHandler.getBlacklist()
        }
      }, {
        key: "addBlacklist", value: function (e) {
          return this.blacklistHandler.addBlacklist(e)
        }
      }, {
        key: "deleteBlacklist", value: function (e) {
          return this.blacklistHandler.deleteBlacklist(e)
        }
      }, {
        key: "applyAddFriend", value: function (e) {
          return this.applyC2CHandler.applyAddFriend(e)
        }
      }, {
        key: "getPendency", value: function (e) {
          return this.applyC2CHandler.getPendency(e)
        }
      }, {
        key: "deletePendency", value: function (e) {
          return this.applyC2CHandler.deletePendency(e)
        }
      }, {
        key: "replyPendency", value: function (e) {
          return this.applyC2CHandler.replyPendency(e)
        }
      }, {
        key: "reset", value: function () {
          z.info("UserController.reset"), this.resetReady(), this.profileHandler.reset(), this.blacklistHandler.reset(), this.checkTimes = 0
        }
      }]), t
    }($o),
    pu = ["groupID", "name", "avatar", "type", "introduction", "notification", "ownerID", "selfInfo", "createTime", "infoSequence", "lastInfoTime", "lastMessage", "nextMessageSeq", "memberNum", "maxMemberNum", "memberList", "joinOption", "groupCustomField"],
    hu = function () {
      function e(t) {
        r(this, e), this.groupID = "", this.name = "", this.avatar = "", this.type = "", this.introduction = "", this.notification = "", this.ownerID = "", this.createTime = "", this.infoSequence = "", this.lastInfoTime = "", this.selfInfo = {
          messageRemindType: "",
          joinTime: "",
          nameCard: "",
          role: ""
        }, this.lastMessage = {
          lastTime: "",
          lastSequence: "",
          fromAccount: "",
          messageForShow: ""
        }, this.nextMessageSeq = "", this.memberNum = "", this.maxMemberNum = "", this.joinOption = "", this.groupCustomField = [], this._initGroup(t)
      }

      return i(e, [{
        key: "_initGroup", value: function (e) {
          for (var t in e) pu.indexOf(t) < 0 || ("selfInfo" !== t ? this[t] = e[t] : this.updateSelfInfo(e[t]))
        }
      }, {
        key: "updateGroup", value: function (e) {
          e.lastMsgTime && (this.lastMessage.lastTime = e.lastMsgTime), e.groupCustomField && Me(this.groupCustomField, e.groupCustomField), ce(this, e, ["members", "errorCode", "lastMsgTime", "groupCustomField"])
        }
      }, {
        key: "updateSelfInfo", value: function (e) {
          var t = e.nameCard, n = e.joinTime, r = e.role, o = e.messageRemindType;
          ce(this.selfInfo, {nameCard: t, joinTime: n, role: r, messageRemindType: o}, [], ["", null, void 0, 0, NaN])
        }
      }, {
        key: "setSelfNameCard", value: function (e) {
          this.selfInfo.nameCard = e
        }
      }]), e
    }(), fu = function (e, n) {
      if (te(n)) return "";
      switch (e) {
        case t.MSG_TEXT:
          return n.text;
        case t.MSG_IMAGE:
          return "[图片]";
        case t.MSG_GEO:
          return "[位置]";
        case t.MSG_AUDIO:
          return "[语音]";
        case t.MSG_VIDEO:
          return "[视频]";
        case t.MSG_FILE:
          return "[文件]";
        case t.MSG_CUSTOM:
          return "[自定义消息]";
        case t.MSG_GRP_TIP:
          return "[群提示消息]";
        case t.MSG_GRP_SYS_NOTICE:
          return "[群系统通知]";
        case t.MSG_FACE:
          return "[动画表情]";
        default:
          return ""
      }
    }, gu = function () {
      function e(t) {
        var n;
        r(this, e), this.conversationID = t.conversationID || "", this.unreadCount = t.unreadCount || 0, this.type = t.type || "", this.lastMessage = (n = t.lastMessage, te(n) ? {
          lastTime: 0,
          lastSequence: 0,
          fromAccount: 0,
          messageForShow: "",
          payload: null,
          type: "",
          isRevoked: !1
        } : n instanceof Gr ? {
          lastTime: n.time || 0,
          lastSequence: n.sequence || 0,
          fromAccount: n.from || "",
          messageForShow: fu(n.type, n.payload),
          payload: n.payload || null,
          type: n.type || null,
          isRevoked: !1
        } : u({}, n, {
          isRevoked: !1,
          messageForShow: fu(n.type, n.payload)
        })), this._isInfoCompleted = !1, this._initProfile(t)
      }

      return i(e, [{
        key: "_initProfile", value: function (e) {
          var n = this;
          Object.keys(e).forEach((function (t) {
            switch (t) {
              case"userProfile":
                n.userProfile = e.userProfile;
                break;
              case"groupProfile":
                n.groupProfile = e.groupProfile
            }
          })), te(this.userProfile) && this.type === t.CONV_C2C ? this.userProfile = new nu({userID: e.conversationID.replace("C2C", "")}) : te(this.groupProfile) && this.type === t.CONV_GROUP && (this.groupProfile = new hu({groupID: e.conversationID.replace("GROUP", "")}))
        }
      }, {
        key: "updateUnreadCount", value: function (e, n) {
          te(e) || (this.subType === t.GRP_CHATROOM || Ie(this.subType) ? this.unreadCount = 0 : n && this.type === t.CONV_GROUP ? this.unreadCount = e : this.unreadCount = this.unreadCount + e)
        }
      }, {
        key: "reduceUnreadCount", value: function () {
          this.unreadCount >= 1 && (this.unreadCount -= 1)
        }
      }, {
        key: "isLastMessageRevoked", value: function (e) {
          var n = e.sequence, r = e.time;
          return this.type === t.CONV_C2C && n === this.lastMessage.lastSequence && r === this.lastMessage.lastTime || this.type === t.CONV_GROUP && n === this.lastMessage.lastSequence
        }
      }, {
        key: "setLastMessageRevoked", value: function (e) {
          this.lastMessage.isRevoked = e
        }
      }, {
        key: "toAccount", get: function () {
          return this.conversationID.replace("C2C", "").replace("GROUP", "")
        }
      }, {
        key: "subType", get: function () {
          return this.groupProfile ? this.groupProfile.type : ""
        }
      }]), e
    }(), du = function (n) {
      function o(e) {
        var t;
        return r(this, o), (t = m(this, l(o).call(this, e))).pagingStatus = Ne.NOT_START, t.pagingTimeStamp = 0, t.conversationMap = new Map, t.tempGroupList = [], t._initListeners(), t
      }

      return c(o, n), i(o, [{
        key: "hasLocalConversationMap", value: function () {
          return this.conversationMap.size > 0
        }
      }, {
        key: "createLocalConversation", value: function (e) {
          return this.conversationMap.has(e) ? this.conversationMap.get(e) : new gu({
            conversationID: e,
            type: e.slice(0, 3) === t.CONV_C2C ? t.CONV_C2C : t.CONV_GROUP
          })
        }
      }, {
        key: "hasLocalConversation", value: function (e) {
          return this.conversationMap.has(e)
        }
      }, {
        key: "getConversationList", value: function () {
          var e = this;
          z.log("ConversationController.getConversationList."), this.pagingStatus === Ne.REJECTED && (z.log("ConversationController.getConversationList. continue to sync conversationList"), this._syncConversationList());
          var t = new ui;
          t.setMethod(Mi).setStart();
          var n = this.createPackage({name: "conversation", action: "query"});
          return this.tim.connectionController.request(n).then((function (n) {
            var r = n.data.conversations, o = void 0 === r ? [] : r, i = e._getConversationOptions(o);
            return e._updateLocalConversationList(i, !0), e._setStorageConversationList(), t.setCode(0).setText(o.length).setEnd(), z.log("ConversationController.getConversationList ok."), Qo({conversationList: e.getLocalConversationList()})
          })).catch((function (n) {
            return e.probeNetwork().then((function (e, r) {
              t.setError(n, e, r).setEnd()
            })), z.error("ConversationController.getConversationList error:", n), Zo(n)
          }))
        }
      }, {
        key: "_syncConversationList", value: function () {
          var e = this, t = new ui;
          return t.setMethod(Ii).setStart(), this.pagingStatus === Ne.NOT_START && this.conversationMap.clear(), this._autoPagingSyncConversationList().then((function (n) {
            return e.pagingStatus = Ne.RESOLVED, e._setStorageConversationList(), t.setCode(0).setText("".concat(e.conversationMap.size)).setEnd(), n
          })).catch((function (n) {
            return e.pagingStatus = Ne.REJECTED, t.setText(e.pagingTimeStamp), e.probeNetwork().then((function (e, r) {
              t.setError(n, e, r).setEnd()
            })), Zo(n)
          }))
        }
      }, {
        key: "_autoPagingSyncConversationList", value: function () {
          var e = this;
          this.pagingStatus = Ne.PENDING;
          var t = this.createPackage({
            name: "conversation",
            action: "pagingQuery",
            param: {fromAccount: this.tim.context.identifier, timeStamp: this.pagingTimeStamp, orderType: 1}
          });
          return this.connectionController.request(t).then((function (t) {
            var n = t.data, r = n.completeFlag, o = n.conversations, i = void 0 === o ? [] : o, s = n.timeStamp;
            if (i.length > 0) {
              var a = e._getConversationOptions(i);
              e._updateLocalConversationList(a, !0)
            }
            return e._isReady ? e._emitConversationUpdate() : e.triggerReady(), e.pagingTimeStamp = s, 1 !== r ? e._autoPagingSyncConversationList() : Qo()
          }))
        }
      }, {
        key: "getConversationProfile", value: function (e) {
          var n = this.conversationMap.has(e) ? this.conversationMap.get(e) : this.createLocalConversation(e);
          return n._isInfoCompleted || n.type === t.CONV_SYSTEM ? Qo({conversation: n}) : (z.log("ConversationController.getConversationProfile. conversationID:", e), this._updateUserOrGroupProfileCompletely(n).then((function (t) {
            return z.log("ConversationController.getConversationProfile ok. conversationID:", e), t
          })).catch((function (e) {
            return z.error("ConversationController.getConversationProfile error:", e), Zo(e)
          })))
        }
      }, {
        key: "deleteConversation", value: function (e) {
          var n = this, r = {};
          if (!this.conversationMap.has(e)) {
            var o = new lt({code: qt, message: Jn});
            return Zo(o)
          }
          switch (this.conversationMap.get(e).type) {
            case t.CONV_C2C:
              r.type = 1, r.toAccount = e.slice(3);
              break;
            case t.CONV_GROUP:
              r.type = 2, r.toGroupID = e.slice(5);
              break;
            case t.CONV_SYSTEM:
              return this.tim.groupController.deleteGroupSystemNotice({messageList: this.tim.messageController.getLocalMessageList(e)}), this.deleteLocalConversation(e), Qo({conversationID: e});
            default:
              var i = new lt({code: Ft, message: Zn});
              return Zo(i)
          }
          z.log("ConversationController.deleteConversation. conversationID:", e);
          var s = this.createPackage({name: "conversation", action: "delete", param: r});
          return this.tim.setMessageRead({conversationID: e}).then((function () {
            return n.connectionController.request(s)
          })).then((function () {
            return z.log("ConversationController.deleteConversation ok. conversationID:", e), n.deleteLocalConversation(e), Qo({conversationID: e})
          })).catch((function (e) {
            return z.error("ConversationController.deleteConversation error:", e), Zo(e)
          }))
        }
      }, {
        key: "getLocalConversationList", value: function () {
          return v(this.conversationMap.values())
        }
      }, {
        key: "getLocalConversation", value: function (e) {
          return this.conversationMap.get(e)
        }
      }, {
        key: "_initLocalConversationList", value: function () {
          var e = new ui;
          e.setMethod(Ci).setStart(), z.time(ii), z.log("ConversationController._initLocalConversationList init");
          var t = this._getStorageConversationList();
          if (t) {
            for (var n = t.length, r = 0; r < n; r++) this.conversationMap.set(t[r].conversationID, new gu(t[r]));
            this._emitConversationUpdate(!0, !1), e.setCode(0).setNetworkType(this.getNetworkType()).setText(n).setEnd()
          } else e.setCode(0).setNetworkType(this.getNetworkType()).setText(0).setEnd();
          this._syncConversationList()
        }
      }, {
        key: "_getStorageConversationList", value: function () {
          return this.tim.storage.getItem("conversationMap")
        }
      }, {
        key: "_setStorageConversationList", value: function () {
          var e = this.getLocalConversationList().slice(0, 20).map((function (e) {
            return {
              conversationID: e.conversationID,
              type: e.type,
              subType: e.subType,
              lastMessage: e.lastMessage,
              groupProfile: e.groupProfile,
              userProfile: e.userProfile
            }
          }));
          this.tim.storage.setItem("conversationMap", e)
        }
      }, {
        key: "_initListeners", value: function () {
          var e = this;
          this.tim.innerEmitter.once(zr, this._initLocalConversationList, this), this.tim.innerEmitter.on(Jr, this._onSendOrReceiveMessage, this), this.tim.innerEmitter.on(Zr, this._handleSyncMessages, this), this.tim.innerEmitter.on(eo, this._handleSyncMessages, this), this.tim.innerEmitter.on(to, this._onSendOrReceiveMessage, this), this.tim.innerEmitter.on(ro, this._onSendOrReceiveMessage, this), this.tim.innerEmitter.on(oo, this._onSendOrReceiveMessage, this), this.tim.innerEmitter.on(Eo, this._updateConversationGroupProfile, this), this.tim.innerEmitter.on(Uo, this._updateConversationUserProfile, this), this.tim.innerEmitter.on(io, this._onMessageRevoked, this), this.ready((function () {
            e.tempGroupList.length > 0 && (e._updateConversationGroupProfile(e.tempGroupList), e.tempGroupList.length = 0)
          }))
        }
      }, {
        key: "_updateConversationGroupProfile", value: function (e) {
          var t = this;
          ee(e) && 0 === e.length || (this.hasLocalConversationMap() ? (e.forEach((function (e) {
            var n = "GROUP".concat(e.groupID);
            if (t.conversationMap.has(n)) {
              var r = t.conversationMap.get(n);
              r.groupProfile = e, r.lastMessage.lastSequence = e.nextMessageSeq - 1, r.subType || (r.subType = e.type)
            }
          })), this._emitConversationUpdate(!0, !1)) : this.tempGroupList = e)
        }
      }, {
        key: "_updateConversationUserProfile", value: function (e) {
          var t = this;
          e.data.forEach((function (e) {
            var n = "C2C".concat(e.userID);
            t.conversationMap.has(n) && (t.conversationMap.get(n).userProfile = e)
          })), this._emitConversationUpdate(!0, !1)
        }
      }, {
        key: "_onMessageRevoked", value: function (e) {
          var t = this, n = e.data;
          if (0 !== n.length) {
            var r = null, o = !1;
            n.forEach((function (e) {
              (r = t.conversationMap.get(e.conversationID)) && r.isLastMessageRevoked(e) && (o = !0, r.setLastMessageRevoked(!0))
            })), o && this._emitConversationUpdate(!0, !1)
          }
        }
      }, {
        key: "_handleSyncMessages", value: function (e) {
          this._onSendOrReceiveMessage(e, !0)
        }
      }, {
        key: "_onSendOrReceiveMessage", value: function (e) {
          var t = this, n = arguments.length > 1 && void 0 !== arguments[1] && arguments[1], r = e.data.eventDataList;
          this._isReady ? 0 !== r.length && (this._updateLocalConversationList(r, !1, n), this._setStorageConversationList(), this._emitConversationUpdate()) : this.ready((function () {
            t._onSendOrReceiveMessage(e, n)
          }))
        }
      }, {
        key: "_updateLocalConversationList", value: function (e, t, n) {
          var r;
          r = this._updateTempConversations(e, t, n), this.conversationMap = new Map(this._sortConversations([].concat(v(r.conversations), v(this.conversationMap)))), t || this._updateUserOrGroupProfile(r.newerConversations)
        }
      }, {
        key: "_updateTempConversations", value: function (e, n, r) {
          for (var o = [], i = [], s = 0, a = e.length; s < a; s++) {
            var u = new gu(e[s]), c = this.conversationMap.get(u.conversationID);
            if (this.conversationMap.has(u.conversationID)) {
              var l = ["unreadCount", "allowType", "adminForbidType", "payload"];
              r && l.push("lastMessage"), ce(c, u, l, [null, void 0, "", 0, NaN]), c.updateUnreadCount(u.unreadCount, n), r || (c.lastMessage.payload = e[s].lastMessage.payload), this.conversationMap.delete(c.conversationID), o.push([c.conversationID, c])
            } else {
              if (u.type === t.CONV_GROUP) {
                var p = u.groupProfile.groupID, h = this.tim.groupController.getLocalGroupProfile(p);
                h && (u.groupProfile = h, u.updateUnreadCount(0))
              }
              i.push(u), o.push([u.conversationID, u])
            }
          }
          return {conversations: o, newerConversations: i}
        }
      }, {
        key: "_sortConversations", value: function (e) {
          return e.sort((function (e, t) {
            return t[1].lastMessage.lastTime - e[1].lastMessage.lastTime
          }))
        }
      }, {
        key: "_updateUserOrGroupProfile", value: function (e) {
          var n = this;
          if (0 !== e.length) {
            var r = [], o = [];
            e.forEach((function (e) {
              if (e.type === t.CONV_C2C) r.push(e.toAccount); else if (e.type === t.CONV_GROUP) {
                var i = e.toAccount;
                n.tim.groupController.hasLocalGroup(i) ? e.groupProfile = n.tim.groupController.getLocalGroupProfile(i) : o.push(i)
              }
            })), r.length > 0 && this.tim.getUserProfile({userIDList: r}).then((function (e) {
              var t = e.data;
              ee(t) ? t.forEach((function (e) {
                n.conversationMap.get("C2C".concat(e.userID)).userProfile = e
              })) : n.conversationMap.get("C2C".concat(t.userID)).userProfile = t
            })), o.length > 0 && this.tim.groupController.getGroupProfileAdvance({
              groupIDList: o,
              responseFilter: {groupBaseInfoFilter: ["Type", "Name", "FaceUrl"]}
            }).then((function (e) {
              e.data.successGroupList.forEach((function (e) {
                var t = "GROUP".concat(e.groupID);
                if (n.conversationMap.has(t)) {
                  var r = n.conversationMap.get(t);
                  ce(r.groupProfile, e, [], [null, void 0, "", 0, NaN]), !r.subType && e.type && (r.subType = e.type)
                }
              }))
            }))
          }
        }
      }, {
        key: "_updateUserOrGroupProfileCompletely", value: function (e) {
          var n = this;
          return e.type === t.CONV_C2C ? this.tim.getUserProfile({userIDList: [e.toAccount]}).then((function (t) {
            var r = t.data;
            return 0 === r.length ? Zo(new lt({
              code: xt,
              message: Qn
            })) : (e.userProfile = r[0], e._isInfoCompleted = !0, n._unshiftConversation(e), Qo({conversation: e}))
          })) : this.tim.getGroupProfile({groupID: e.toAccount}).then((function (t) {
            return e.groupProfile = t.data.group, e._isInfoCompleted = !0, n._unshiftConversation(e), Qo({conversation: e})
          }))
        }
      }, {
        key: "_unshiftConversation", value: function (e) {
          e instanceof gu && !this.conversationMap.has(e.conversationID) && (this.conversationMap = new Map([[e.conversationID, e]].concat(v(this.conversationMap))), this._setStorageConversationList(), this._emitConversationUpdate(!0, !1))
        }
      }, {
        key: "deleteLocalConversation", value: function (e) {
          return this.conversationMap.delete(e), this._setStorageConversationList(), this.tim.innerEmitter.emit(Go, e), this._emitConversationUpdate(!0, !1), this.conversationMap.has(e)
        }
      }, {
        key: "_getConversationOptions", value: function (e) {
          var t = [], n = e.filter((function (e) {
            var t = e.lastMsg;
            return Z(t)
          })).map((function (e) {
            if (1 === e.type) {
              var n = {userID: e.userID, nick: e.c2CNick, avatar: e.c2CImage};
              return t.push(n), {
                conversationID: "C2C".concat(e.userID),
                type: "C2C",
                lastMessage: {
                  lastTime: e.time,
                  lastSequence: e.sequence,
                  fromAccount: e.lastC2CMsgFromAccount,
                  messageForShow: e.messageShow,
                  type: e.lastMsg.elements[0] ? e.lastMsg.elements[0].type : null,
                  payload: e.lastMsg.elements[0] ? e.lastMsg.elements[0].content : null
                },
                userProfile: new nu(n)
              }
            }
            return {
              conversationID: "GROUP".concat(e.groupID),
              type: "GROUP",
              lastMessage: {
                lastTime: e.time,
                lastSequence: e.messageReadSeq + e.unreadCount,
                fromAccount: e.msgGroupFromAccount,
                messageForShow: e.messageShow,
                type: e.lastMsg.elements[0] ? e.lastMsg.elements[0].type : null,
                payload: e.lastMsg.elements[0] ? e.lastMsg.elements[0].content : null
              },
              groupProfile: new hu({groupID: e.groupID, name: e.groupNick, avatar: e.groupImage}),
              unreadCount: e.unreadCount
            }
          }));
          return t.length > 0 && this.tim.innerEmitter.emit(No, {data: t}), n
        }
      }, {
        key: "_emitConversationUpdate", value: function () {
          var t = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0],
            n = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1], r = v(this.conversationMap.values());
          n && this.tim.innerEmitter.emit(Oo, r), t && this.tim.outerEmitter.emit(e.CONVERSATION_LIST_UPDATED, r)
        }
      }, {
        key: "_conversationMapTreeShaking", value: function (e) {
          var n = this, r = new Map(v(this.conversationMap));
          e.forEach((function (e) {
            return r.delete(e.conversationID)
          })), r.has(t.CONV_SYSTEM) && r.delete(t.CONV_SYSTEM);
          var o = this.tim.groupController.getJoinedAVChatRoom();
          o && r.delete("".concat(t.CONV_GROUP).concat(o.groupID)), v(r.keys()).forEach((function (e) {
            return n.conversationMap.delete(e)
          }))
        }
      }, {
        key: "reset", value: function () {
          this.pagingStatus = Ne.NOT_START, this.pagingTimeStamp = 0, this.conversationMap.clear(), this.resetReady(), this.tim.innerEmitter.once(zr, this._initLocalConversationList, this)
        }
      }]), o
    }($o), mu = function () {
      function e(t) {
        if (r(this, e), void 0 === t) throw new lt({code: Mt, message: bn});
        if (void 0 === t.tim) throw new lt({code: Mt, message: "".concat(bn, ".tim")});
        this.list = new Map, this.tim = t.tim, this._initializeOptions(t)
      }

      return i(e, [{
        key: "getLocalOldestMessageByConversationID", value: function (e) {
          if (!e) return null;
          if (!this.list.has(e)) return null;
          var t = this.list.get(e).values();
          return t ? t.next().value : null
        }
      }, {
        key: "_initializeOptions", value: function (e) {
          this.options = {};
          var t = {
            memory: {maxDatasPerKey: 100, maxBytesPerData: 256, maxKeys: 0},
            cache: {maxDatasPerKey: 10, maxBytesPerData: 256, maxKeys: 0}
          };
          for (var n in t) if (Object.prototype.hasOwnProperty.call(t, n)) {
            if (void 0 === e[n]) {
              this.options[n] = t[n];
              continue
            }
            var r = t[n];
            for (var o in r) if (Object.prototype.hasOwnProperty.call(r, o)) {
              if (void 0 === e[n][o]) {
                this.options[n][o] = r[o];
                continue
              }
              this.options[n][o] = e[n][o]
            }
          }
        }
      }, {
        key: "pushIn", value: function (e) {
          var t = e.conversationID, n = e.ID, r = !0;
          return this.list.has(t) || this.list.set(t, new Map), this.list.has(t) && this.list.get(t).has(n) ? r = !1 : this.list.get(t).set(n, e), r
        }
      }, {
        key: "unshift", value: function (e) {
          ee(e) ? e.length > 0 && this._unshiftMultipleMessages(e) : this._unshiftSingleMessage(e)
        }
      }, {
        key: "_unshiftSingleMessage", value: function (e) {
          var t = e.conversationID, n = e.ID;
          if (!this.list.has(t)) return this.list.set(t, new Map), void this.list.get(t).set(n, e);
          var r = Array.from(this.list.get(t));
          r.unshift([n, e]), this.list.set(t, new Map(r))
        }
      }, {
        key: "_unshiftMultipleMessages", value: function (e) {
          for (var t = e.length, n = [], r = e[0].conversationID, o = this.list.has(r) ? Array.from(this.list.get(r)) : [], i = 0; i < t; i++) n.push([e[i].ID, e[i]]);
          this.list.set(r, new Map(n.concat(o)))
        }
      }, {
        key: "remove", value: function (e) {
          var t = e.conversationID, n = e.ID;
          this.list.has(t) && this.list.get(t).delete(n)
        }
      }, {
        key: "revoke", value: function (e, t, n) {
          if (z.debug("revoke message", e, t, n), this.list.has(e)) {
            var r = this.list.get(e), o = !0, i = !1, s = void 0;
            try {
              for (var a, u = r[Symbol.iterator](); !(o = (a = u.next()).done); o = !0) {
                var c = y(a.value, 2)[1];
                if (c.sequence === t && !c.isRevoked && (te(n) || c.random === n)) return c.isRevoked = !0, c
              }
            } catch (l) {
              i = !0, s = l
            } finally {
              try {
                o || null == u.return || u.return()
              } finally {
                if (i) throw s
              }
            }
          }
          return null
        }
      }, {
        key: "removeByConversationID", value: function (e) {
          this.list.has(e) && this.list.delete(e)
        }
      }, {
        key: "hasLocalMessageList", value: function (e) {
          return this.list.has(e)
        }
      }, {
        key: "getLocalMessageList", value: function (e) {
          return this.hasLocalMessageList(e) ? v(this.list.get(e).values()) : []
        }
      }, {
        key: "hasLocalMessage", value: function (e, t) {
          return !!this.hasLocalMessageList(e) && this.list.get(e).has(t)
        }
      }, {
        key: "getLocalMessage", value: function (e, t) {
          return this.hasLocalMessage(e, t) ? this.list.get(e).get(t) : null
        }
      }, {
        key: "reset", value: function () {
          this.list.clear()
        }
      }]), e
    }(), yu = function () {
      function e(t) {
        r(this, e), this.tim = t
      }

      return i(e, [{
        key: "setMessageRead", value: function (e) {
          var n = e.conversationID, r = e.messageID, o = this.tim.conversationController.getLocalConversation(n);
          if (z.log("ReadReportHandler.setMessageRead conversationID=".concat(n, " unreadCount=").concat(o ? o.unreadCount : 0)), !o || 0 === o.unreadCount) return Qo();
          var i = r ? this.tim.messageController.getLocalMessage(n, r) : null;
          switch (o.type) {
            case t.CONV_C2C:
              return this._setC2CMessageRead({conversationID: n, lastMessageTime: i ? i.time : o.lastMessage.lastTime});
            case t.CONV_GROUP:
              return this._setGroupMessageRead({
                conversationID: n,
                lastMessageSeq: i ? i.sequence : o.lastMessage.lastSequence
              });
            case t.CONV_SYSTEM:
              return o.unreadCount = 0, Qo();
            default:
              return Qo()
          }
        }
      }, {
        key: "_setC2CMessageRead", value: function (e) {
          var t = this, n = e.conversationID, r = e.lastMessageTime;
          z.log("ReadReportHandler._setC2CMessageRead conversationID=".concat(n, " lastMessageTime=").concat(r));
          var o = this.tim.messageController.createPackage({
            name: "conversation",
            action: "setC2CMessageRead",
            param: {C2CMsgReaded: {cookie: "", C2CMsgReadedItem: [{toAccount: n.replace("C2C", ""), lastMessageTime: r}]}}
          });
          this._updateIsReadAfterReadReport({conversationID: n, lastMessageTime: r}), this._updateUnreadCount(n);
          var i = new ui;
          return i.setMethod(vi).setText("".concat(n, "-").concat(r)).setStart(), this.tim.connectionController.request(o).then((function () {
            return i.setCode(0).setNetworkType(t.tim.netMonitor.getNetworkType()).setEnd(), z.log("ReadReportHandler._setC2CMessageRead ok."), new Wo
          })).catch((function (e) {
            return t.tim.netMonitor.probe().then((function (t, n) {
              i.setError(e, t, n).setEnd()
            })), z.log("ReadReportHandler._setC2CMessageRead failed. ".concat(e)), Zo(e)
          }))
        }
      }, {
        key: "_setGroupMessageRead", value: function (e) {
          var t = this, n = e.conversationID, r = e.lastMessageSeq;
          z.log("ReadReportHandler._setGroupMessageRead conversationID=".concat(n, " lastMessageSeq=").concat(r));
          var o = this.tim.messageController.createPackage({
            name: "conversation",
            action: "setGroupMessageRead",
            param: {groupID: n.replace("GROUP", ""), messageReadSeq: r}
          });
          this._updateIsReadAfterReadReport({conversationID: n, lastMessageSeq: r}), this._updateUnreadCount(n);
          var i = new ui;
          return i.setMethod(_i).setText("".concat(n, "-").concat(r)).setStart(), this.tim.connectionController.request(o).then((function () {
            return i.setCode(0).setNetworkType(t.tim.netMonitor.getNetworkType()).setEnd(), z.log("ReadReportHandler._setGroupMessageRead ok."), new Wo
          })).catch((function (e) {
            return t.tim.netMonitor.probe().then((function (t, n) {
              i.setError(e, t, n).setEnd()
            })), z.log("ReadReportHandler._setGroupMessageRead failed. ".concat(e)), Zo(e)
          }))
        }
      }, {
        key: "_updateUnreadCount", value: function (e) {
          var t = this.tim, n = t.conversationController, r = t.messageController, o = n.getLocalConversation(e),
            i = r.getLocalMessageList(e);
          o && (o.unreadCount = i.filter((function (e) {
            return !e.isRead
          })).length)
        }
      }, {
        key: "_updateIsReadAfterReadReport", value: function (e) {
          var t = e.conversationID, n = e.lastMessageSeq, r = e.lastMessageTime,
            o = this.tim.messageController.getLocalMessageList(t);
          if (0 !== o.length) for (var i = o.length - 1; i >= 0; i--) {
            var s = o[i];
            if (!(r && s.time > r || n && s.sequence > n)) {
              if ("in" === s.flow && s.isRead) break;
              s.setIsRead(!0)
            }
          }
        }
      }, {
        key: "updateIsRead", value: function (e) {
          var n = this.tim, r = n.conversationController, o = n.messageController, i = r.getLocalConversation(e),
            s = o.getLocalMessageList(e);
          if (i && 0 !== s.length && !Se(i.type)) {
            for (var a = [], u = 0; u < s.length; u++) "in" !== s[u].flow ? "out" !== s[u].flow || s[u].isRead || s[u].setIsRead(!0) : a.push(s[u]);
            var c = 0;
            if (i.type === t.CONV_C2C) {
              var l = a.slice(-i.unreadCount).filter((function (e) {
                return e.isRevoked
              })).length;
              c = a.length - i.unreadCount - l
            } else c = a.length - i.unreadCount;
            for (var p = 0; p < c && !a[p].isRead; p++) a[p].setIsRead(!0)
          }
        }
      }]), e
    }(), vu = function () {
      function e(t) {
        var n = t.tim, o = t.messageController;
        r(this, e), this.tim = n, this.messageController = o, this.completedMap = new Map, this._initListener()
      }

      return i(e, [{
        key: "getMessageList", value: function (e) {
          var t = this, n = e.conversationID, r = e.nextReqMessageID, o = e.count;
          if (this.tim.groupController.checkJoinedAVChatRoomByID(n.replace("GROUP", ""))) return z.log("GetMessageHandler.getMessageList not available in avchatroom. conversationID=".concat(n)), Qo({
            messageList: [],
            nextReqMessageID: "",
            isCompleted: !0
          });
          (te(o) || o > 15) && (o = 15);
          var i = this._computeLeftCount({conversationID: n, nextReqMessageID: r});
          return z.log("GetMessageHandler.getMessageList. conversationID=".concat(n, " leftCount=").concat(i, " count=").concat(o, " nextReqMessageID=").concat(r)), this._needGetHistory({
            conversationID: n,
            leftCount: i,
            count: o
          }) ? this.messageController.getHistoryMessages({conversationID: n, count: 20}).then((function () {
            return i = t._computeLeftCount({
              conversationID: n,
              nextReqMessageID: r
            }), new Wo(t._computeResult({conversationID: n, nextReqMessageID: r, count: o, leftCount: i}))
          })) : (z.log("GetMessageHandler.getMessageList. get messagelist from memory"), Qo(this._computeResult({
            conversationID: n,
            nextReqMessageID: r,
            count: o,
            leftCount: i
          })))
        }
      }, {
        key: "setCompleted", value: function (e) {
          z.log("GetMessageHandler.setCompleted. conversationID=".concat(e)), this.completedMap.set(e, !0)
        }
      }, {
        key: "deleteCompletedItem", value: function (e) {
          z.log("GetMessageHandler.deleteCompletedItem. conversationID=".concat(e)), this.completedMap.delete(e)
        }
      }, {
        key: "_initListener", value: function () {
          var e = this;
          this.tim.innerEmitter.on(xo, (function () {
            e.setCompleted(t.CONV_SYSTEM)
          })), this.tim.innerEmitter.on(qo, (function (n) {
            var r = n.data;
            e.setCompleted("".concat(t.CONV_GROUP).concat(r))
          }))
        }
      }, {
        key: "_getMessageListSize", value: function (e) {
          return this.messageController.getLocalMessageList(e).length
        }
      }, {
        key: "_needGetHistory", value: function (e) {
          var n = e.conversationID, r = e.leftCount, o = e.count,
            i = this.tim.conversationController.getLocalConversation(n), s = !!i && i.type === t.CONV_SYSTEM,
            a = !!i && i.subType === t.GRP_AVCHATROOM;
          return !s && !a && (r < o && !this.completedMap.has(n))
        }
      }, {
        key: "_computeResult", value: function (e) {
          var t = e.conversationID, n = e.nextReqMessageID, r = e.count, o = e.leftCount,
            i = this._computeMessageList({conversationID: t, nextReqMessageID: n, count: r}),
            s = this._computeIsCompleted({conversationID: t, leftCount: o, count: r}),
            a = this._computeNextReqMessageID({messageList: i, isCompleted: s, conversationID: t});
          return z.log("GetMessageHandler._computeResult. conversationID=".concat(t, " leftCount=").concat(o, " count=").concat(r, " nextReqMessageID=").concat(a, " nums=").concat(i.length, " isCompleted=").concat(s)), {
            messageList: i,
            nextReqMessageID: a,
            isCompleted: s
          }
        }
      }, {
        key: "_computeNextReqMessageID", value: function (e) {
          var t = e.messageList, n = e.isCompleted, r = e.conversationID;
          if (!n) return 0 === t.length ? "" : t[0].ID;
          var o = this.messageController.getLocalMessageList(r);
          return 0 === o.length ? "" : o[0].ID
        }
      }, {
        key: "_computeMessageList", value: function (e) {
          var t = e.conversationID, n = e.nextReqMessageID, r = e.count,
            o = this.messageController.getLocalMessageList(t),
            i = this._computeIndexEnd({nextReqMessageID: n, messageList: o}),
            s = this._computeIndexStart({indexEnd: i, count: r});
          return o.slice(s, i)
        }
      }, {
        key: "_computeIndexEnd", value: function (e) {
          var t = e.messageList, n = void 0 === t ? [] : t, r = e.nextReqMessageID;
          return r ? n.findIndex((function (e) {
            return e.ID === r
          })) : n.length
        }
      }, {
        key: "_computeIndexStart", value: function (e) {
          var t = e.indexEnd, n = e.count;
          return t > n ? t - n : 0
        }
      }, {
        key: "_computeLeftCount", value: function (e) {
          var t = e.conversationID, n = e.nextReqMessageID;
          return n ? this.messageController.getLocalMessageList(t).findIndex((function (e) {
            return e.ID === n
          })) : this._getMessageListSize(t)
        }
      }, {
        key: "_computeIsCompleted", value: function (e) {
          var t = e.conversationID;
          return !!(e.leftCount <= e.count && this.completedMap.has(t))
        }
      }, {
        key: "reset", value: function () {
          z.log("GetMessageHandler.reset"), this.completedMap.clear()
        }
      }]), e
    }(), _u = function e(t) {
      r(this, e), this.value = t, this.next = null
    }, Mu = function () {
      function e(t) {
        r(this, e), this.MAX_LENGTH = t, this.pTail = null, this.pNodeToDel = null, this.map = new Map, z.log("SinglyLinkedList init MAX_LENGTH=".concat(this.MAX_LENGTH))
      }

      return i(e, [{
        key: "pushIn", value: function (e) {
          var t = new _u(e);
          if (this.map.size < this.MAX_LENGTH) null === this.pTail ? (this.pTail = t, this.pNodeToDel = t) : (this.pTail.next = t, this.pTail = t), this.map.set(e, 1); else {
            var n = this.pNodeToDel;
            this.pNodeToDel = this.pNodeToDel.next, this.map.delete(n.value), n.next = null, n = null, this.pTail.next = t, this.pTail = t, this.map.set(e, 1)
          }
        }
      }, {
        key: "has", value: function (e) {
          return this.map.has(e)
        }
      }, {
        key: "reset", value: function () {
          for (var e; null !== this.pNodeToDel;) e = this.pNodeToDel, this.pNodeToDel = this.pNodeToDel.next, e.next = null, e = null;
          this.pTail = null, this.map.clear()
        }
      }]), e
    }(), Cu = function () {
      function e(t) {
        r(this, e), this.tim = t
      }

      return i(e, [{
        key: "upload", value: function (e) {
          switch (e.type) {
            case t.MSG_IMAGE:
              return this._uploadImage(e);
            case t.MSG_FILE:
              return this._uploadFile(e);
            case t.MSG_AUDIO:
              return this._uploadAudio(e);
            case t.MSG_VIDEO:
              return this._uploadVideo(e);
            default:
              return Promise.resolve()
          }
        }
      }, {
        key: "_uploadImage", value: function (e) {
          var t = this.tim, n = t.uploadController, r = t.messageController, o = e.getElements()[0],
            i = r.getMessageOptionByID(e.messageID);
          return n.uploadImage({
            file: i.payload.file, to: i.to, onProgress: function (e) {
              if (o.updatePercent(e), re(i.onProgress)) try {
                i.onProgress(e)
              } catch (t) {
                return Zo(new lt({code: Dt, message: "".concat(Un)}))
              }
            }
          }).then((function (e) {
            var t, n = e.location, r = e.fileType, i = e.fileSize, s = _e(n);
            return o.updateImageFormat(r), o.updateImageInfoArray({
              size: i,
              url: s
            }), t = o._imageMemoryURL, E ? new Promise((function (e, n) {
              wx.getImageInfo({
                src: t, success: function (t) {
                  e({width: t.width, height: t.height})
                }, fail: function () {
                  e({width: 0, height: 0})
                }
              })
            })) : N && 9 === G ? Promise.resolve({width: 0, height: 0}) : new Promise((function (e, n) {
              var r = new Image;
              r.onload = function () {
                e({width: this.width, height: this.height}), r = null
              }, r.onerror = function () {
                e({width: 0, height: 0}), r = null
              }, r.src = t
            }))
          })).then((function (t) {
            var n = t.width, r = t.height;
            return o.updateImageInfoArray({width: n, height: r}), e
          }))
        }
      }, {
        key: "_uploadFile", value: function (e) {
          var t = this.tim, n = t.uploadController, r = t.messageController, o = e.getElements()[0],
            i = r.getMessageOptionByID(e.messageID);
          return n.uploadFile({
            file: i.payload.file, to: i.to, onProgress: function (e) {
              if (o.updatePercent(e), re(i.onProgress)) try {
                i.onProgress(e)
              } catch (t) {
                return Zo(new lt({code: Dt, message: "".concat(Un)}))
              }
            }
          }).then((function (t) {
            var n = t.location, r = _e(n);
            return o.updateFileUrl(r), e
          }))
        }
      }, {
        key: "_uploadAudio", value: function (e) {
          var t = this.tim, n = t.uploadController, r = t.messageController, o = e.getElements()[0],
            i = r.getMessageOptionByID(e.messageID);
          return n.uploadAudio({
            file: i.payload.file, to: i.to, onProgress: function (e) {
              if (o.updatePercent(e), re(i.onProgress)) try {
                i.onProgress(e)
              } catch (t) {
                return Zo(new lt({code: Dt, message: "".concat(Un)}))
              }
            }
          }).then((function (t) {
            var n = t.location, r = _e(n);
            return o.updateAudioUrl(r), e
          }))
        }
      }, {
        key: "_uploadVideo", value: function (e) {
          var t = this.tim, n = t.uploadController, r = t.messageController, o = e.getElements()[0],
            i = r.getMessageOptionByID(e.messageID);
          return n.uploadVideo({
            file: i.payload.file, to: i.to, onProgress: function (e) {
              if (o.updatePercent(e), re(i.onProgress)) try {
                i.onProgress(e)
              } catch (t) {
                return Zo(new lt({code: Dt, message: "".concat(Un)}))
              }
            }
          }).then((function (t) {
            if (E) {
              var n = _e(t.location);
              return o.updateVideoUrl(n), e
            }
          }))
        }
      }]), e
    }(), Iu = function (n) {
      function o(e) {
        var t;
        return r(this, o), (t = m(this, l(o).call(this, e)))._initializeMembers(), t._initializeListener(), t._initialzeHandlers(), t.messageOptionMap = new Map, t
      }

      return c(o, n), i(o, [{
        key: "_initializeMembers", value: function () {
          this.messagesList = new mu({tim: this.tim}), this.currentMessageKey = {}, this.singlyLinkedList = new Mu(100)
        }
      }, {
        key: "_initialzeHandlers", value: function () {
          this.readReportHandler = new yu(this.tim), this.getMessageHandler = new vu({
            messageController: this,
            tim: this.tim
          }), this.uploadFileHandler = new Cu(this.tim)
        }
      }, {
        key: "reset", value: function () {
          this.messagesList.reset(), this.currentMessageKey = {}, this.getMessageHandler.reset(), this.singlyLinkedList.reset(), this.messageOptionMap.clear()
        }
      }, {
        key: "_initializeListener", value: function () {
          var e = this.tim.innerEmitter;
          e.on(yo, this._onReceiveC2CMessage, this), e.on(Wr, this._onSyncMessagesProcessing, this), e.on(Xr, this._onSyncMessagesFinished, this), e.on(vo, this._onReceiveGroupMessage, this), e.on(_o, this._onReceiveGroupTips, this), e.on(Mo, this._onReceiveSystemNotice, this), e.on(ko, this._onReceiveGroupMessageRevokedNotice, this), e.on(To, this._onReceiveC2CMessageRevokedNotice, this), e.on(Go, this._clearConversationMessages, this)
        }
      }, {
        key: "sendMessageInstance", value: function (e) {
          var n, r = this, o = this.tim, i = o.innerEmitter, s = o.sumStatController, a = null;
          switch (e.conversationType) {
            case t.CONV_C2C:
              a = this._handleOnSendC2CMessageSuccess.bind(this);
              break;
            case t.CONV_GROUP:
              a = this._handleOnSendGroupMessageSuccess.bind(this);
              break;
            default:
              return Zo(new lt({code: It, message: Nn}))
          }
          return this.singlyLinkedList.pushIn(e.random), this.uploadFileHandler.upload(e).then((function () {
            var o = null;
            return e.isSendable() ? (s.addTotalCount(oi), n = Date.now(), e.conversationType === t.CONV_C2C ? o = r._createC2CMessagePack(e) : e.conversationType === t.CONV_GROUP && (o = r._createGroupMessagePack(e)), r.tim.connectionController.request(o)) : Zo({
              code: Ut,
              message: Xn
            })
          })).then((function (o) {
            return s.addSuccessCount(oi), s.addCost(oi, Math.abs(Date.now() - n)), e.conversationType === t.CONV_GROUP && (e.sequence = o.data.sequence, e.time = o.data.time, e.generateMessageID(r.tim.context.identifier)), r.messagesList.pushIn(e), a(e, o.data), r.messageOptionMap.delete(e.messageID), i.emit(Jr, {
              data: {
                eventDataList: [{
                  conversationID: e.conversationID,
                  unreadCount: 0,
                  type: e.conversationType,
                  subType: e.conversationSubType,
                  lastMessage: e
                }]
              }
            }), new Wo({message: e})
          })).catch((function (t) {
            e.status = Pe.FAIL;
            var n = new ui;
            return n.setMethod(gi).setMessageType(e.type).setText("".concat(r._generateTjgID(e), "-").concat(e.type, "-").concat(e.from, "-").concat(e.to)).setStart(), r.probeNetwork().then((function (e, r) {
              n.setError(t, e, r).setEnd()
            })), z.error("MessageController.sendMessageInstance error:", t), Zo(new lt({
              code: t && t.code ? t.code : _t,
              message: t && t.message ? t.message : Pn,
              data: {message: e}
            }))
          }))
        }
      }, {
        key: "resendMessage", value: function (e) {
          return e.isResend = !0, e.status = Pe.UNSEND, this.sendMessageInstance(e)
        }
      }, {
        key: "_isFileLikeMessage", value: function (e) {
          return [t.MSG_IMAGE, t.MSG_FILE, t.MSG_AUDIO, t.MSG_VIDEO].indexOf(e.type) >= 0
        }
      }, {
        key: "_resendBinaryTypeMessage", value: function () {
        }
      }, {
        key: "_createC2CMessagePack", value: function (e) {
          return this.createPackage({
            name: "c2cMessage",
            action: "create",
            tjgID: this._generateTjgID(e),
            param: {toAccount: e.to, msgBody: e.getElements(), msgSeq: e.sequence, msgRandom: e.random}
          })
        }
      }, {
        key: "_handleOnSendC2CMessageSuccess", value: function (e, t) {
          var n = this.tim.innerEmitter;
          e.status = Pe.SUCCESS, e.time = t.time, n.emit(Qr, {
            data: {
              eventDataList: [{
                conversationID: e.conversationID,
                unreadCount: 0,
                type: e.conversationType,
                subType: e.conversationSubType,
                lastMessage: e
              }]
            }
          })
        }
      }, {
        key: "_createGroupMessagePack", value: function (e) {
          return this.createPackage({
            name: "groupMessage",
            action: "create",
            tjgID: this._generateTjgID(e),
            param: {
              groupID: e.to,
              msgBody: e.getElements(),
              random: e.random,
              priority: e.priority,
              clientSequence: e.clientSequence
            }
          })
        }
      }, {
        key: "_handleOnSendGroupMessageSuccess", value: function (e, t) {
          var n = this.tim.innerEmitter;
          e.sequence = t.sequence, e.time = t.time, e.status = Pe.SUCCESS, n.emit(no, {
            data: {
              eventDataList: [{
                conversationID: e.conversationID,
                unreadCount: 0,
                type: e.conversationType,
                subType: e.conversationSubType,
                lastMessage: e
              }]
            }
          })
        }
      }, {
        key: "_onReceiveC2CMessage", value: function (n) {
          z.debug("MessageController._onReceiveC2CMessage nums=".concat(n.data.length));
          var r = this.tim, o = r.innerEmitter, i = r.outerEmitter, s = this._newC2CMessageStoredAndSummary({
            notifiesList: n.data,
            type: t.CONV_C2C,
            C2CRemainingUnreadList: n.C2CRemainingUnreadList
          }), a = s.eventDataList, u = s.result;
          a.length > 0 && o.emit(to, {
            data: {eventDataList: a, result: u},
            resource: this
          }), u.length > 0 && i.emit(e.MESSAGE_RECEIVED, u)
        }
      }, {
        key: "_onReceiveGroupMessage", value: function (t) {
          z.debug("MessageController._onReceiveGroupMessage nums=".concat(t.data.length));
          var n = this.tim, r = n.outerEmitter, o = n.innerEmitter, i = this.newGroupMessageStoredAndSummary(t.data),
            s = i.eventDataList, a = i.result;
          s.length > 0 && o.emit(ro, {
            data: {
              eventDataList: s,
              result: a,
              isGroupTip: !1
            }
          }), a.length > 0 && r.emit(e.MESSAGE_RECEIVED, a)
        }
      }, {
        key: "_onReceiveGroupTips", value: function (t) {
          var n = this.tim, r = n.outerEmitter, o = n.innerEmitter, i = t.data;
          z.debug("MessageController._onReceiveGroupTips nums=".concat(i.length));
          var s = this.newGroupTipsStoredAndSummary(i), a = s.eventDataList, u = s.result;
          a.length > 0 && o.emit(ro, {
            data: {
              eventDataList: a,
              result: u,
              isGroupTip: !0
            }
          }), u.length > 0 && r.emit(e.MESSAGE_RECEIVED, u)
        }
      }, {
        key: "_onReceiveSystemNotice", value: function (t) {
          var n = this.tim, r = n.outerEmitter, o = n.innerEmitter, i = t.data, s = i.groupSystemNotices, a = i.type;
          z.debug("MessageController._onReceiveSystemNotice nums=".concat(s.length));
          var u = this.newSystemNoticeStoredAndSummary({notifiesList: s, type: a}), c = u.eventDataList, l = u.result;
          c.length > 0 && o.emit(oo, {
            data: {
              eventDataList: c,
              result: l,
              type: a
            }
          }), l.length > 0 && "poll" === a && r.emit(e.MESSAGE_RECEIVED, l)
        }
      }, {
        key: "_onReceiveGroupMessageRevokedNotice", value: function (t) {
          var n = this;
          z.debug("MessageController._onReceiveGroupMessageRevokedNotice nums=".concat(t.data.length));
          var r = [], o = null;
          t.data.forEach((function (e) {
            e.elements.revokedInfos.forEach((function (e) {
              (o = n.messagesList.revoke("GROUP".concat(e.groupID), e.sequence)) && r.push(o)
            }))
          })), 0 !== r.length && (this.tim.innerEmitter.emit(io, {data: r}), this.tim.outerEmitter.emit(e.MESSAGE_REVOKED, r))
        }
      }, {
        key: "_onReceiveC2CMessageRevokedNotice", value: function (t) {
          var n = this;
          z.debug("MessageController._onReceiveC2CMessageRevokedNotice nums=".concat(t.data.length));
          var r = [], o = null;
          t.data.forEach((function (e) {
            e.c2cMessageRevokedNotify.revokedInfos.forEach((function (e) {
              (o = n.messagesList.revoke("C2C".concat(e.from), e.sequence, e.random)) && r.push(o)
            }))
          })), 0 !== r.length && (this.tim.innerEmitter.emit(io, {data: r}), this.tim.outerEmitter.emit(e.MESSAGE_REVOKED, r))
        }
      }, {
        key: "_clearConversationMessages", value: function (e) {
          this.messagesList.removeByConversationID(e), this.getMessageHandler.deleteCompletedItem(e)
        }
      }, {
        key: "_pushIntoNoticeResult", value: function (e, t) {
          var n = this.messagesList.pushIn(t), r = this.singlyLinkedList.has(t.random);
          return !(!n || !1 !== r) && (e.push(t), !0)
        }
      }, {
        key: "_newC2CMessageStoredAndSummary", value: function (e) {
          for (var n = e.notifiesList, r = e.type, o = e.C2CRemainingUnreadList, i = e.isFromSync, s = null, a = [], u = [], c = {}, l = this.tim.bigDataHallwayController, p = 0, h = n.length; p < h; p++) {
            var f = n[p];
            if (f.currentUser = this.tim.context.identifier, f.conversationType = r, f.isSystemMessage = !!f.isSystemMessage, s = new Gr(f), f.elements = l.parseElements(f.elements, f.from), s.setElement(f.elements), !i) if (!this._pushIntoNoticeResult(u, s)) continue;
            void 0 === c[s.conversationID] ? c[s.conversationID] = a.push({
              conversationID: s.conversationID,
              unreadCount: "out" === s.flow ? 0 : 1,
              type: s.conversationType,
              subType: s.conversationSubType,
              lastMessage: s
            }) - 1 : (a[c[s.conversationID]].type = s.conversationType, a[c[s.conversationID]].subType = s.conversationSubType, a[c[s.conversationID]].lastMessage = s, "in" === s.flow && a[c[s.conversationID]].unreadCount++)
          }
          if (ee(o)) for (var g = function (e, n) {
            var r = a.find((function (t) {
              return t.conversationID === "C2C".concat(o[e].from)
            }));
            r ? r.unreadCount += o[e].count : a.push({
              conversationID: "C2C".concat(o[e].from),
              unreadCount: o[e].count,
              type: t.CONV_C2C
            })
          }, d = 0, m = o.length; d < m; d++) g(d);
          return {eventDataList: a, result: u}
        }
      }, {
        key: "newGroupMessageStoredAndSummary", value: function (e) {
          for (var n = null, r = [], o = {}, i = [], s = t.CONV_GROUP, a = this.tim.bigDataHallwayController, u = 0, c = e.length; u < c; u++) {
            var l = e[u];
            l.currentUser = this.tim.context.identifier, l.conversationType = s, l.isSystemMessage = !!l.isSystemMessage, n = new Gr(l), l.elements = a.parseElements(l.elements, l.from), n.setElement(l.elements), this._pushIntoNoticeResult(i, n) && (void 0 === o[n.conversationID] ? o[n.conversationID] = r.push({
              conversationID: n.conversationID,
              unreadCount: "out" === n.flow ? 0 : 1,
              type: n.conversationType,
              subType: n.conversationSubType,
              lastMessage: n
            }) - 1 : (r[o[n.conversationID]].type = n.conversationType, r[o[n.conversationID]].subType = n.conversationSubType, r[o[n.conversationID]].lastMessage = n, "in" === n.flow && r[o[n.conversationID]].unreadCount++))
          }
          return {eventDataList: r, result: i}
        }
      }, {
        key: "newGroupTipsStoredAndSummary", value: function (e) {
          for (var n = null, r = [], o = [], i = {}, s = 0, a = e.length; s < a; s++) {
            var c = e[s];
            c.currentUser = this.tim.context.identifier, c.conversationType = t.CONV_GROUP, (n = new Gr(c)).setElement({
              type: t.MSG_GRP_TIP,
              content: u({}, c.elements, {groupProfile: c.groupProfile})
            }), n.isSystemMessage = !1, this._pushIntoNoticeResult(o, n) && (void 0 === i[n.conversationID] ? i[n.conversationID] = r.push({
              conversationID: n.conversationID,
              unreadCount: "out" === n.flow ? 0 : 1,
              type: n.conversationType,
              subType: n.conversationSubType,
              lastMessage: n
            }) - 1 : (r[i[n.conversationID]].type = n.conversationType, r[i[n.conversationID]].subType = n.conversationSubType, r[i[n.conversationID]].lastMessage = n, "in" === n.flow && r[i[n.conversationID]].unreadCount++))
          }
          return {eventDataList: r, result: o}
        }
      }, {
        key: "newSystemNoticeStoredAndSummary", value: function (e) {
          var n = e.notifiesList, r = e.type, o = null, i = n.length, s = 0, a = [],
            c = {conversationID: t.CONV_SYSTEM, unreadCount: 0, type: t.CONV_SYSTEM, subType: null, lastMessage: null};
          for (s = 0; s < i; s++) {
            var l = n[s];
            if (l.elements.operationType !== Ye) l.currentUser = this.tim.context.identifier, l.conversationType = t.CONV_SYSTEM, l.conversationID = t.CONV_SYSTEM, (o = new Gr(l)).setElement({
              type: t.MSG_GRP_SYS_NOTICE,
              content: u({}, l.elements, {groupProfile: l.groupProfile})
            }), o.isSystemMessage = !0, this._pushIntoNoticeResult(a, o) && ("poll" === r ? c.unreadCount++ : "sync" === r && o.setIsRead(!0), c.subType = o.conversationSubType)
          }
          return c.lastMessage = a[a.length - 1], {eventDataList: a.length > 0 ? [c] : [], result: a}
        }
      }, {
        key: "_onSyncMessagesProcessing", value: function (e) {
          var n = this._newC2CMessageStoredAndSummary({
            notifiesList: e.data,
            type: t.CONV_C2C,
            isFromSync: !0,
            C2CRemainingUnreadList: e.C2CRemainingUnreadList
          }), r = n.eventDataList, o = n.result;
          this.tim.innerEmitter.emit(Zr, {data: {eventDataList: r, result: o}, resource: this})
        }
      }, {
        key: "_onSyncMessagesFinished", value: function (e) {
          this.triggerReady();
          var n = this._newC2CMessageStoredAndSummary({
            notifiesList: e.data,
            type: t.CONV_C2C,
            isFromSync: !0,
            C2CRemainingUnreadList: e.C2CRemainingUnreadList
          }), r = n.eventDataList, o = n.result;
          this.tim.innerEmitter.emit(eo, {data: {eventDataList: r, result: o}, resource: this})
        }
      }, {
        key: "getHistoryMessages", value: function (e) {
          if (e.conversationID === t.CONV_SYSTEM) return Qo();
          !e.count && (e.count = 15), e.count > 20 && (e.count = 20);
          var n = this.messagesList.getLocalOldestMessageByConversationID(e.conversationID);
          n || ((n = {}).time = 0, n.sequence = 0, 0 === e.conversationID.indexOf(t.CONV_C2C) ? (n.to = e.conversationID.replace(t.CONV_C2C, ""), n.conversationType = t.CONV_C2C) : 0 === e.conversationID.indexOf(t.CONV_GROUP) && (n.to = e.conversationID.replace(t.CONV_GROUP, ""), n.conversationType = t.CONV_GROUP));
          var r = "";
          switch (n.conversationType) {
            case t.CONV_C2C:
              return r = e.conversationID.replace(t.CONV_C2C, ""), this.getC2CRoamMessages({
                conversationID: e.conversationID,
                peerAccount: r,
                count: e.count,
                lastMessageTime: void 0 === this.currentMessageKey[e.conversationID] ? 0 : n.time
              });
            case t.CONV_GROUP:
              return this.getGroupRoamMessages({
                conversationID: e.conversationID,
                groupID: n.to,
                count: e.count,
                sequence: n.sequence - 1
              });
            default:
              return Qo()
          }
        }
      }, {
        key: "getC2CRoamMessages", value: function (e) {
          var n = this, r = this.tim.connectionController,
            o = void 0 !== this.currentMessageKey[e.conversationID] ? this.currentMessageKey[e.conversationID] : "",
            i = this.createPackage({
              name: "c2cMessage",
              action: "query",
              param: {
                peerAccount: e.peerAccount,
                count: e.count || 15,
                lastMessageTime: e.lastMessageTime || 0,
                messageKey: o
              }
            });
          z.log("MessageController.getC2CRoamMessages toAccount=".concat(e.peerAccount, " count=").concat(e.count || 15, " lastMessageTime=").concat(e.lastMessageTime || 0, " messageKey=").concat(o));
          var s = new ui;
          return s.setMethod(di).setStart(), r.request(i).then((function (r) {
            var i = r.data, a = i.complete, u = i.messageList;
            te(u) ? z.log("MessageController.getC2CRoamMessages ok. complete=".concat(a, " but messageList is undefined!")) : z.log("MessageController.getC2CRoamMessages ok. complete=".concat(a, " nums=").concat(u.length)), s.setCode(0).setNetworkType(n.getNetworkType()).setText("".concat(e.peerAccount, "-").concat(e.count || 15, "-").concat(e.lastMessageTime || 0, "-").concat(o, "-").concat(a, "-").concat(u ? u.length : "undefined")).setEnd(), 1 === a && n.getMessageHandler.setCompleted(e.conversationID);
            var c = n._roamMessageStore(u, t.CONV_C2C, e.conversationID);
            return n.readReportHandler.updateIsRead(e.conversationID), n.currentMessageKey[e.conversationID] = r.data.messageKey, c
          })).catch((function (t) {
            return n.probeNetwork().then((function (n, r) {
              s.setError(t, n, r).setText("".concat(e.peerAccount, "-").concat(e.count || 15, "-").concat(e.lastMessageTime || 0, "-").concat(o)).setEnd()
            })), z.warn("MessageController.getC2CRoamMessages failed. ".concat(t)), Zo(t)
          }))
        }
      }, {
        key: "_computeLastSequence", value: function (e) {
          if (z.log("MessageController._computeLastSequence groupID=".concat(e.groupID, " options.sequence=").concat(e.sequence)), e.sequence >= 0) return e.sequence;
          var t = 0, n = this.tim, r = n.groupController, o = n.conversationController;
          if (r.hasLocalGroup(e.groupID)) {
            var i = r.getLocalGroupProfile(e.groupID);
            z.log("MessageController._computeLastSequence lastSequence=".concat(i.lastMessage.lastSequence, " nextMessageSeq=").concat(i.nextMessageSeq)), t = i.lastMessage.lastSequence ? i.lastMessage.lastSequence : i.nextMessageSeq ? i.nextMessageSeq - 1 : -1
          } else z.log("GroupController._computeLastSequence ".concat(e.groupID, " not in groupMap")), t = -1;
          if (t < 0) {
            var s = "GROUP".concat(e.groupID), a = o.getLocalConversation(s);
            a && a.lastMessage.lastSequence ? (t = a.lastMessage.lastSequence, z.log("MessageController._computeLastSequence get lastSequence=".concat(t, " from conversationID=").concat(s))) : (t = 0, z.warn("MessageController._computeLastSequence can not compute lastSequence, set to 0"))
          }
          return t
        }
      }, {
        key: "getGroupRoamMessages", value: function (e) {
          var n = this, r = this.tim.connectionController, o = this._computeLastSequence(e);
          z.log("MessageController.getGroupRoamMessages groupID=".concat(e.groupID, " lastSequence=").concat(o));
          var i = this.createPackage({
            name: "groupMessage",
            action: "query",
            param: {groupID: e.groupID, count: 21, sequence: o}
          }), s = new ui;
          return s.setMethod(mi).setStart(), r.request(i).then((function (r) {
            var i = r.data, a = i.messageList, u = i.complete;
            te(a) ? z.log("MessageController.getGroupRoamMessages ok. complete=".concat(u, " but messageList is undefined!")) : z.log("MessageController.getGroupRoamMessages ok. complete=".concat(u, " nums=").concat(a.length)), s.setCode(0).setNetworkType(n.getNetworkType()).setText("".concat(e.groupID, "-").concat(o, "-").concat(u, "-").concat(a ? a.length : "undefined")).setEnd();
            var c = "GROUP".concat(e.groupID);
            if (2 === u || Te(a)) return n.getMessageHandler.setCompleted(c), [];
            var l = n._roamMessageStore(a, t.CONV_GROUP, c);
            return n.readReportHandler.updateIsRead(c), l
          })).catch((function (t) {
            return n.probeNetwork().then((function (n, r) {
              s.setError(t, n, r).setText("".concat(e.groupID, "-").concat(o)).setEnd()
            })), z.warn("MessageController.getGroupRoamMessages failed. ".concat(t)), Zo(t)
          }))
        }
      }, {
        key: "_roamMessageStore", value: function () {
          var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [],
            n = arguments.length > 1 ? arguments[1] : void 0, r = arguments.length > 2 ? arguments[2] : void 0, o = null,
            i = [], s = 0, a = e.length, c = null, l = n === t.CONV_GROUP, p = this.tim.bigDataHallwayController,
            h = function () {
              s = l ? e.length - 1 : 0, a = l ? 0 : e.length
            }, f = function () {
              l ? --s : ++s
            }, g = function () {
              return l ? s >= a : s < a
            };
          for (h(); g(); f()) l && 1 === e[s].sequence && this.getMessageHandler.setCompleted(r), 1 !== e[s].isPlaceMessage && ((o = new Gr(e[s])).to = e[s].to, o.isSystemMessage = !!e[s].isSystemMessage, o.conversationType = n, e[s].event === Ue.JSON.TYPE.GROUP.TIP ? c = {
            type: t.MSG_GRP_TIP,
            content: u({}, e[s].elements, {groupProfile: e[s].groupProfile})
          } : (e[s].elements = p.parseElements(e[s].elements, e[s].from), c = e[s].elements), o.setElement(c), o.reInitialize(this.tim.context.identifier), i.push(o));
          return this.messagesList.unshift(i), h = f = g = null, i
        }
      }, {
        key: "getLocalMessageList", value: function (e) {
          return this.messagesList.getLocalMessageList(e)
        }
      }, {
        key: "getLocalMessage", value: function (e, t) {
          return this.messagesList.getLocalMessage(e, t)
        }
      }, {
        key: "hasLocalMessage", value: function (e, t) {
          return this.messagesList.hasLocalMessage(e, t)
        }
      }, {
        key: "deleteLocalMessage", value: function (e) {
          e instanceof Gr && this.messagesList.remove(e)
        }
      }, {
        key: "revokeMessage", value: function (e) {
          var n, r = this;
          e.conversationType === t.CONV_C2C ? n = this.createPackage({
            name: "c2cMessageWillBeRevoked",
            action: "create",
            param: {
              msgInfo: {
                fromAccount: e.from,
                toAccount: e.to,
                msgSeq: e.sequence,
                msgRandom: e.random,
                msgTimeStamp: e.time
              }
            }
          }) : e.conversationType === t.CONV_GROUP && (n = this.createPackage({
            name: "groupMessageWillBeRevoked",
            action: "create",
            param: {to: e.to, msgSeqList: [{msgSeq: e.sequence}]}
          }));
          var o = new ui;
          return o.setMethod(yi).setMessageType(e.type).setText("".concat(this._generateTjgID(e), "-").concat(e.type, "-").concat(e.from, "-").concat(e.to)).setStart(), this.tim.connectionController.request(n).then((function (t) {
            var n = t.data.recallRetList;
            if (!Te(n) && 0 !== n[0].retCode) {
              var i = new lt({code: n[0].retCode, message: ct[n[0].retCode] || qn, data: {message: e}});
              return o.setCode(i.code).setMessage(i.message).setEnd(), Zo(i)
            }
            return z.info("MessageController.revokeMessage ok. ID=".concat(e.ID)), e.isRevoked = !0, o.setCode(0).setEnd(), r.innerEmitter.emit(io, {data: [e]}), new Wo({message: e})
          })).catch((function (t) {
            r.probeNetwork().then((function (e, n) {
              o.setError(t, e, n).setEnd()
            }));
            var n = new lt({
              code: t && t.code ? t.code : kt,
              message: t && t.message ? t.message : qn,
              data: {message: e}
            });
            return z.warn("MessageController.revokeMessage failed. ID=".concat(e.ID, " code=").concat(n.code, " message=").concat(n.message)), Zo(n)
          }))
        }
      }, {
        key: "setMessageRead", value: function (e) {
          var t = this;
          return new Promise((function (n, r) {
            t.ready((function () {
              t.readReportHandler.setMessageRead(e).then(n).catch(r)
            }))
          }))
        }
      }, {
        key: "getMessageList", value: function (e) {
          return this.getMessageHandler.getMessageList(e)
        }
      }, {
        key: "createTextMessage", value: function (e) {
          e.currentUser = this.tim.context.identifier;
          var t = new Gr(e), n = "string" == typeof e.payload ? e.payload : e.payload.text, r = new Ge({text: n});
          return t.setElement(r), t
        }
      }, {
        key: "createCustomMessage", value: function (e) {
          e.currentUser = this.tim.context.identifier;
          var t = new Gr(e),
            n = new Pr({data: e.payload.data, description: e.payload.description, extension: e.payload.extension});
          return t.setElement(n), t
        }
      }, {
        key: "createImageMessage", value: function (e) {
          e.currentUser = this.tim.context.identifier;
          var t = new Gr(e);
          if (E) {
            var n = e.payload.file;
            if (W(n)) return void z.warn("微信小程序环境下调用 createImageMessage 接口时，payload.file 不支持传入 File 对象");
            var r = n.tempFilePaths[0], o = {
              url: r,
              name: r.slice(r.lastIndexOf("/") + 1),
              size: n.tempFiles[0].size,
              type: r.slice(r.lastIndexOf(".") + 1).toLowerCase()
            };
            e.payload.file = o
          } else if (T && W(e.payload.file)) {
            var i = e.payload.file;
            e.payload.file = {files: [i]}
          }
          var s = new nt({imageFormat: "UNKNOWN", uuid: this._generateUUID(), file: e.payload.file});
          return t.setElement(s), this.messageOptionMap.set(t.messageID, e), t
        }
      }, {
        key: "createFileMessage", value: function (e) {
          if (!E) {
            if (T && W(e.payload.file)) {
              var t = e.payload.file;
              e.payload.file = {files: [t]}
            }
            e.currentUser = this.tim.context.identifier;
            var n = new Gr(e), r = new Lr({uuid: this._generateUUID(), file: e.payload.file});
            return n.setElement(r), this.messageOptionMap.set(n.messageID, e), n
          }
          z.warn("微信小程序目前不支持选择文件， createFileMessage 接口不可用！")
        }
      }, {
        key: "createAudioMessage", value: function (e) {
          if (E) {
            var t = e.payload.file;
            if (E) {
              var n = {
                url: t.tempFilePath,
                name: t.tempFilePath.slice(t.tempFilePath.lastIndexOf("/") + 1),
                size: t.fileSize,
                second: parseInt(t.duration) / 1e3,
                type: t.tempFilePath.slice(t.tempFilePath.lastIndexOf(".") + 1).toLowerCase()
              };
              e.payload.file = n
            }
            e.currentUser = this.tim.context.identifier;
            var r = new Gr(e), o = new ot({
              second: Math.floor(t.duration / 1e3),
              size: t.fileSize,
              url: t.tempFilePath,
              uuid: this._generateUUID()
            });
            return r.setElement(o), this.messageOptionMap.set(r.messageID, e), r
          }
          z.warn("createAudioMessage 目前只支持微信小程序发语音消息")
        }
      }, {
        key: "createVideoMessage", value: function (e) {
          if (E) {
            if (e.currentUser = this.tim.context.identifier, E) {
              e.payload.file.thumbUrl = "https://webim-1252463788.cos.ap-shanghai.myqcloud.com/assets/images/transparent.png", e.payload.file.thumbSize = 1668;
              var t = e.payload.file, n = {
                url: t.tempFilePath,
                name: t.tempFilePath.slice(t.tempFilePath.lastIndexOf("/") + 1),
                size: t.size,
                second: t.duration,
                type: t.tempFilePath.slice(t.tempFilePath.lastIndexOf(".") + 1).toLowerCase()
              };
              e.payload.file.videoFile = n;
              var r = new Gr(e), o = new br({
                videoFormat: n.type,
                videoSecond: Number(n.second.toFixed(0)),
                videoSize: n.size,
                remoteVideoUrl: "",
                videoUrl: n.url,
                videoUUID: this._generateUUID(),
                thumbUUID: this._generateUUID(),
                thumbWidth: t.width,
                thumbHeight: t.height,
                thumbUrl: t.thumbUrl,
                thumbSize: t.thumbSize,
                thumbFormat: t.thumbUrl.slice(t.thumbUrl.lastIndexOf(".") + 1).toLowerCase()
              });
              return r.setElement(o), this.messageOptionMap.set(r.messageID, e), r
            }
          } else {
            z.warn("createVideoMessage 目前只支持微信小程序发视频消息")
          }
        }
      }, {
        key: "createFaceMessage", value: function (e) {
          e.currentUser = this.tim.context.identifier;
          var t = new Gr(e), n = new rt(e.payload);
          return t.setElement(n), t
        }
      }, {
        key: "_generateUUID", value: function () {
          var e = this.tim.context;
          return "".concat(e.SDKAppID, "-").concat(e.identifier, "-").concat(function () {
            for (var e = "", t = 32; t > 0; --t) e += ge[Math.floor(Math.random() * de)];
            return e
          }())
        }
      }, {
        key: "_generateTjgID", value: function (e) {
          return this.tim.context.tinyID + "-" + e.random
        }
      }, {
        key: "getMessageOptionByID", value: function (e) {
          return this.messageOptionMap.get(e)
        }
      }]), o
    }($o), Su = function () {
      function e(t) {
        r(this, e), this.userID = "", this.avatar = "", this.nick = "", this.role = "", this.joinTime = "", this.lastSendMsgTime = "", this.nameCard = "", this.muteUntil = 0, this.memberCustomField = [], this._initMember(t)
      }

      return i(e, [{
        key: "_initMember", value: function (e) {
          this.updateMember(e)
        }
      }, {
        key: "updateMember", value: function (e) {
          var t = [null, void 0, "", 0, NaN];
          e.memberCustomField && Me(this.memberCustomField, e.memberCustomField), ce(this, e, ["memberCustomField"], t)
        }
      }, {
        key: "updateRole", value: function (e) {
          ["Owner", "Admin", "Member"].indexOf(e) < 0 || (this.role = e)
        }
      }, {
        key: "updateMuteUntil", value: function (e) {
          te(e) || (this.muteUntil = Math.floor((Date.now() + 1e3 * e) / 1e3))
        }
      }, {
        key: "updateNameCard", value: function (e) {
          te(e) || (this.nameCard = e)
        }
      }, {
        key: "updateMemberCustomField", value: function (e) {
          e && Me(this.memberCustomField, e)
        }
      }]), e
    }(), Du = function () {
      function e(t) {
        r(this, e), this.tim = t.tim, this.groupController = t.groupController, this._initListeners()
      }

      return i(e, [{
        key: "_initListeners", value: function () {
          this.tim.innerEmitter.on(ro, this._onReceivedGroupTips, this)
        }
      }, {
        key: "_onReceivedGroupTips", value: function (e) {
          var t = this, n = e.data, r = n.result;
          n.isGroupTip && r.forEach((function (e) {
            switch (e.payload.operationType) {
              case 1:
                t._onNewMemberComeIn(e);
                break;
              case 2:
                t._onMemberQuit(e);
                break;
              case 3:
                t._onMemberKickedOut(e);
                break;
              case 4:
                t._onMemberSetAdmin(e);
                break;
              case 5:
                t._onMemberCancelledAdmin(e);
                break;
              case 6:
                t._onGroupProfileModified(e);
                break;
              case 7:
                t._onMemberInfoModified(e);
                break;
              default:
                z.warn("GroupTipsHandler._onReceivedGroupTips Unhandled groupTips. operationType=", e.payload.operationType)
            }
          }))
        }
      }, {
        key: "_onNewMemberComeIn", value: function (e) {
          var t = e.payload, n = t.memberNum, r = t.groupProfile.groupID,
            o = this.groupController.getLocalGroupProfile(r);
          o && X(n) && (o.memberNum = n)
        }
      }, {
        key: "_onMemberQuit", value: function (e) {
          var t = e.payload, n = t.memberNum, r = t.groupProfile.groupID,
            o = this.groupController.getLocalGroupProfile(r);
          o && X(n) && (o.memberNum = n), this.groupController.deleteLocalGroupMembers(r, e.payload.userIDList)
        }
      }, {
        key: "_onMemberKickedOut", value: function (e) {
          var t = e.payload, n = t.memberNum, r = t.groupProfile.groupID,
            o = this.groupController.getLocalGroupProfile(r);
          o && X(n) && (o.memberNum = n), this.groupController.deleteLocalGroupMembers(r, e.payload.userIDList)
        }
      }, {
        key: "_onMemberSetAdmin", value: function (e) {
          var n = this, r = e.payload.groupProfile.groupID;
          e.payload.userIDList.forEach((function (e) {
            var o = n.groupController.getLocalGroupMemberInfo(r, e);
            o && o.updateRole(t.GRP_MBR_ROLE_ADMIN)
          }))
        }
      }, {
        key: "_onMemberCancelledAdmin", value: function (e) {
          var n = this, r = e.payload.groupProfile.groupID;
          e.payload.userIDList.forEach((function (e) {
            var o = n.groupController.getLocalGroupMemberInfo(r, e);
            o && o.updateRole(t.GRP_MBR_ROLE_MEMBER)
          }))
        }
      }, {
        key: "_onGroupProfileModified", value: function (e) {
          var t = this, n = e.payload.newGroupProfile, r = e.payload.groupProfile.groupID,
            o = this.groupController.getLocalGroupProfile(r);
          Object.keys(n).forEach((function (e) {
            switch (e) {
              case"ownerID":
                t._ownerChaged(o, n);
                break;
              default:
                o[e] = n[e]
            }
          })), this.groupController.emitGroupListUpdate(!0, !0)
        }
      }, {
        key: "_ownerChaged", value: function (e, n) {
          var r = e.groupID, o = this.groupController.getLocalGroupProfile(r), i = this.tim.context.identifier;
          if (i === n.ownerID) {
            o.updateGroup({selfInfo: {role: t.GRP_MBR_ROLE_OWNER}});
            var s = this.groupController.getLocalGroupMemberInfo(r, i),
              a = this.groupController.getLocalGroupProfile(r).ownerID,
              u = this.groupController.getLocalGroupMemberInfo(r, a);
            s && s.updateRole(t.GRP_MBR_ROLE_OWNER), u && u.updateRole(t.GRP_MBR_ROLE_MEMBER)
          }
        }
      }, {
        key: "_onMemberInfoModified", value: function (e) {
          var t = this, n = e.payload.groupProfile.groupID;
          e.payload.memberList.forEach((function (e) {
            var r = t.groupController.getLocalGroupMemberInfo(n, e.userID);
            r && e.muteTime && r.updateMuteUntil(e.muteTime)
          }))
        }
      }]), e
    }(), ku = function () {
      function n(e) {
        r(this, n), this.groupController = e.groupController, this.tim = e.tim, this.pendencyMap = new Map, this._initLiceners()
      }

      return i(n, [{
        key: "_initLiceners", value: function () {
          this.tim.innerEmitter.on(oo, this._onReceivedGroupSystemNotice, this), this.tim.innerEmitter.on(Xr, this._clearGroupSystemNotice, this)
        }
      }, {
        key: "_clearGroupSystemNotice", value: function () {
          var e = this;
          this.getPendencyList().then((function (n) {
            n.forEach((function (t) {
              e.pendencyMap.set("".concat(t.from, "_").concat(t.groupID, "_").concat(t.to), t)
            }));
            var r = e.tim.messageController.getLocalMessageList(t.CONV_SYSTEM), o = [];
            r.forEach((function (t) {
              var n = t.payload, r = n.operatorID, i = n.operationType, s = n.groupProfile;
              if (i === qe) {
                var a = "".concat(r, "_").concat(s.groupID, "_").concat(s.to), u = e.pendencyMap.get(a);
                u && X(u.handled) && 0 !== u.handled && o.push(t)
              }
            })), e.groupController.deleteGroupSystemNotice({messageList: o})
          }))
        }
      }, {
        key: "getPendencyList", value: function (e) {
          var t = this, n = this.groupController.createPackage({
            name: "group",
            action: "getGroupPendency",
            param: {
              startTime: e && e.startTime ? e.startTime : 0,
              limit: e && e.limit ? e.limit : 10,
              handleAccount: this.tim.context.identifier
            }
          });
          return this.groupController.connectionController.request(n).then((function (e) {
            var n = e.data, r = n.pendencyList;
            return 0 !== n.nextStartTime ? t.getPendencyList({startTime: n.nextStartTime}).then((function (e) {
              return [].concat(v(r), v(e))
            })) : r
          }))
        }
      }, {
        key: "_onReceivedGroupSystemNotice", value: function (t) {
          var n = this, r = t.data, o = r.result;
          "sync" !== r.type && o.forEach((function (t) {
            switch (t.payload.operationType) {
              case 1:
                n._onApplyGroupRequest(t);
                break;
              case 2:
                n._onApplyGroupRequestAgreed(t);
                break;
              case 3:
                n._onApplyGroupRequestRefused(t);
                break;
              case 4:
                n._onMemberKicked(t);
                break;
              case 5:
                n._onGroupDismissed(t);
                break;
              case 6:
                break;
              case 7:
                n._onInviteGroup(t);
                break;
              case 8:
                n._onQuitGroup(t);
                break;
              case 9:
                n._onSetManager(t);
                break;
              case 10:
                n._onDeleteManager(t);
                break;
              case 11:
              case 12:
              case 15:
                break;
              case 255:
                n.tim.outerEmitter.emit(e.GROUP_SYSTEM_NOTICE_RECEIVED, {message: t, type: ze})
            }
          }))
        }
      }, {
        key: "_onApplyGroupRequest", value: function (t) {
          this.tim.outerEmitter.emit(e.GROUP_SYSTEM_NOTICE_RECEIVED, {message: t, type: qe})
        }
      }, {
        key: "_onApplyGroupRequestAgreed", value: function (t) {
          var n = this, r = t.payload.groupProfile.groupID;
          this.groupController.hasLocalGroup(r) || this.groupController.getGroupProfile({groupID: r}).then((function (e) {
            var t = e.data.group;
            t && (n.groupController.updateGroupMap([t]), n.groupController.emitGroupListUpdate())
          })), this.tim.outerEmitter.emit(e.GROUP_SYSTEM_NOTICE_RECEIVED, {message: t, type: xe})
        }
      }, {
        key: "_onApplyGroupRequestRefused", value: function (t) {
          this.tim.outerEmitter.emit(e.GROUP_SYSTEM_NOTICE_RECEIVED, {message: t, type: Fe})
        }
      }, {
        key: "_onMemberKicked", value: function (t) {
          var n = t.payload.groupProfile.groupID;
          this.groupController.hasLocalGroup(n) && this.groupController.deleteLocalGroupAndConversation(n), this.tim.outerEmitter.emit(e.GROUP_SYSTEM_NOTICE_RECEIVED, {
            message: t,
            type: He
          })
        }
      }, {
        key: "_onGroupDismissed", value: function (t) {
          var n = t.payload.groupProfile.groupID, r = this.groupController.hasLocalGroup(n),
            o = this.groupController.AVChatRoomHandler;
          r && this.groupController.deleteLocalGroupAndConversation(n), o.checkJoinedAVChatRoomByID(n) && o.reset(), this.tim.outerEmitter.emit(e.GROUP_SYSTEM_NOTICE_RECEIVED, {
            message: t,
            type: Be
          })
        }
      }, {
        key: "_onInviteGroup", value: function (t) {
          var n = this, r = t.payload.groupProfile.groupID;
          this.groupController.hasLocalGroup(r) || this.groupController.getGroupProfile({groupID: r}).then((function (e) {
            var t = e.data.group;
            t && (n.groupController.updateGroupMap([t]), n.groupController.emitGroupListUpdate())
          })), this.tim.outerEmitter.emit(e.GROUP_SYSTEM_NOTICE_RECEIVED, {message: t, type: Ke})
        }
      }, {
        key: "_onQuitGroup", value: function (t) {
          var n = t.payload.groupProfile.groupID;
          this.groupController.hasLocalGroup(n) && this.groupController.deleteLocalGroupAndConversation(n), this.tim.outerEmitter.emit(e.GROUP_SYSTEM_NOTICE_RECEIVED, {
            message: t,
            type: Ve
          })
        }
      }, {
        key: "_onSetManager", value: function (n) {
          var r = n.payload.groupProfile, o = r.to, i = r.groupID, s = this.groupController.getLocalGroupMemberInfo(i, o);
          s && s.updateRole(t.GRP_MBR_ROLE_ADMIN), this.tim.outerEmitter.emit(e.GROUP_SYSTEM_NOTICE_RECEIVED, {
            message: n,
            type: je
          })
        }
      }, {
        key: "_onDeleteManager", value: function (n) {
          var r = n.payload.groupProfile, o = r.to, i = r.groupID, s = this.groupController.getLocalGroupMemberInfo(i, o);
          s && s.updateRole(t.GRP_MBR_ROLE_MEMBER), this.tim.outerEmitter.emit(e.GROUP_SYSTEM_NOTICE_RECEIVED, {
            message: n,
            type: $e
          })
        }
      }, {
        key: "reset", value: function () {
          this.pendencyMap.clear()
        }
      }]), n
    }(), Tu = {3: !0, 4: !0, 5: !0, 6: !0}, Eu = function () {
      function n(e) {
        var t = e.tim, o = e.groupController;
        r(this, n), this.tim = t, this.groupController = o, this.AVChatRoomLoop = null, this.key = "", this.startSeq = 0, this.group = {}
      }

      return i(n, [{
        key: "hasJoinedAVChatRoom", value: function () {
          return !(!this.group || te(this.group.groupID))
        }
      }, {
        key: "checkJoinedAVChatRoomByID", value: function (e) {
          return !(!this.group && te(this.group.groupID)) && e === this.group.groupID
        }
      }, {
        key: "getJoinedAVChatRoom", value: function () {
          return this.hasJoinedAVChatRoom() ? this.group : null
        }
      }, {
        key: "_updateProperties", value: function (e) {
          var t = this;
          Object.keys(e).forEach((function (n) {
            t[n] = e[n]
          }))
        }
      }, {
        key: "start", value: function () {
          var e = {key: this.key, startSeq: this.startSeq};
          if (null === this.AVChatRoomLoop) {
            var t = this.tim.notificationController.createPackage({
              name: "AVChatRoom",
              action: "startLongPoll",
              param: e
            });
            this.AVChatRoomLoop = this.tim.connectionController.createRunLoop({
              pack: t,
              before: this._updateRequestData.bind(this),
              success: this._handleSuccess.bind(this),
              fail: this._handleFailure.bind(this)
            }), this.AVChatRoomLoop.start(), z.log("AVChatRoomHandler.start message channel started")
          } else this.AVChatRoomLoop.isRunning() || this.AVChatRoomLoop.start()
        }
      }, {
        key: "stop", value: function () {
          null !== this.AVChatRoomLoop && this.AVChatRoomLoop.isRunning() && (this.AVChatRoomLoop.abort(), this.AVChatRoomLoop.stop(), z.log("AVChatRoomHandler.stop message channel stopped"))
        }
      }, {
        key: "startRunLoop", value: function (e) {
          var t = this;
          return this._precheck().then((function () {
            var n = e.longPollingKey, r = e.group;
            return t._updateProperties({
              key: n,
              startSeq: 0,
              group: r || {}
            }), t.groupController.updateGroupMap([r]), t.groupController.emitGroupListUpdate(!0, !1), t.start(), t.groupController.isLoggedIn() ? Qo({
              status: Ae.SUCCESS,
              group: r
            }) : Qo({status: Ae.SUCCESS})
          }))
        }
      }, {
        key: "joinWithoutAuth", value: function (e) {
          var t = this, n = this.groupController.createPackage({name: "group", action: "applyJoinAVChatRoom", param: e});
          return this.tim.connectionController.request(n).then((function (n) {
            var r = n.data.longPollingKey;
            if (te(r)) return Zo(new lt({code: zt, message: ar}));
            z.log("AVChatRoomHandler.joinWithoutAuth ok. groupID:", e.groupID), t.tim.innerEmitter.emit(qo, {data: e.groupID});
            var o = new hu({groupID: e.groupID});
            return t.startRunLoop({group: o, longPollingKey: r}), new Wo({status: Ae.SUCCESS})
          })).catch((function (t) {
            return z.error("AVChatRoomHandler.joinWithoutAuth error:".concat(t.message, ". groupID:").concat(e.groupID)), Zo(t)
          }))
        }
      }, {
        key: "_precheck", value: function () {
          if (!this.hasJoinedAVChatRoom()) return Promise.resolve();
          if (this.groupController.isLoggedIn()) {
            if (!(this.group.selfInfo.role === t.GRP_MBR_ROLE_OWNER || this.group.ownerID === this.tim.loginInfo.identifier)) return this.groupController.quitGroup(this.group.groupID);
            this.groupController.deleteLocalGroupAndConversation(this.group.groupID)
          } else this.groupController.deleteLocalGroupAndConversation(this.group.groupID);
          return this.reset(), Promise.resolve()
        }
      }, {
        key: "_updateRequestData", value: function (e) {
          e.StartSeq = this.startSeq, e.Key = this.key, this.tim.sumStatController.addTotalCount(ri)
        }
      }, {
        key: "_handleSuccess", value: function (e) {
          this.tim.sumStatController.addSuccessCount(ri), this.tim.sumStatController.addCost(ri, e.data.timecost), this.startSeq = e.data.nextSeq, this.key = e.data.key, Array.isArray(e.data.rspMsgList) && e.data.rspMsgList.forEach((function (e) {
            e.to = e.groupID
          })), e.data.rspMsgList && e.data.rspMsgList.length > 0 && this._dispatchNotice(e.data.rspMsgList)
        }
      }, {
        key: "_handleFailure", value: function (e) {
          if (e.error) {
            var t = new ui;
            t.setMethod(Gi).setStart(), this.groupController.probeNetwork((function (n, r) {
              t.setError(e.error, n, r).setEnd()
            })), this.tim.innerEmitter.emit(bo, e.error)
          }
        }
      }, {
        key: "_dispatchNotice", value: function (n) {
          if (ee(n) && 0 !== n.length) {
            for (var r = null, o = [], i = [], s = 0; s < n.length; s++) Tu[n[s].event] ? (r = this.packMessage(n[s], n[s].event), this.tim.messageController.hasLocalMessage(r.conversationID, r.ID) || (r.conversationType === t.CONV_SYSTEM && i.push(r), o.push(r))) : z.warn("AVChatRoomHandler._dispatchMessage 未处理的 event 类型：", n[s].event);
            if (i.length > 0 && this.tim.innerEmitter.emit(oo, {
              data: {
                result: i,
                eventDataList: [],
                type: "poll"
              }
            }), 0 !== o.length) {
              var a = this.packConversationOption(o);
              a.length > 0 && this.tim.innerEmitter.emit(ro, {
                data: {
                  eventDataList: a,
                  type: "poll"
                }
              }), z.debug("AVChatRoomHandler._dispatchNotice nums=".concat(o.length)), this.tim.outerEmitter.emit(e.MESSAGE_RECEIVED, o)
            }
          }
        }
      }, {
        key: "packMessage", value: function (e, n) {
          e.currentUser = this.tim.context.identifier, e.conversationType = 5 === n ? t.CONV_SYSTEM : t.CONV_GROUP, e.isSystemMessage = !!e.isSystemMessage;
          var r = new Gr(e), o = this.packElements(e, n);
          return r.setElement(o), r
        }
      }, {
        key: "packElements", value: function (e, n) {
          return 4 === n || 6 === n ? {
            type: t.MSG_GRP_TIP,
            content: u({}, e.elements, {groupProfile: e.groupProfile})
          } : 5 === n ? {
            type: t.MSG_GRP_SYS_NOTICE,
            content: u({}, e.elements, {groupProfile: e.groupProfile})
          } : this.tim.bigDataHallwayController.parseElements(e.elements, e.from)
        }
      }, {
        key: "packConversationOption", value: function (e) {
          for (var t = new Map, n = 0; n < e.length; n++) {
            var r = e[n], o = r.conversationID;
            if (t.has(o)) {
              var i = t.get(o);
              i.lastMessage = r, "in" === r.flow && i.unreadCount++
            } else t.set(o, {
              conversationID: r.conversationID,
              unreadCount: "out" === r.flow ? 0 : 1,
              type: r.conversationType,
              subType: r.conversationSubType,
              lastMessage: r
            })
          }
          return v(t.values())
        }
      }, {
        key: "reset", value: function () {
          null !== this.AVChatRoomLoop && (z.log("AVChatRoomHandler.reset"), this.stop(), this.AVChatRoomLoop = null, this.key = "", this.startSeq = 0, this.group = {})
        }
      }]), n
    }(), wu = function (n) {
      function o(e) {
        var t;
        return r(this, o), (t = m(this, l(o).call(this, e))).groupMap = new Map, t.groupMemberListMap = new Map, t.groupNoticeHandler = new ku({
          tim: e,
          groupController: d(t)
        }), t.groupTipsHandler = new Du({tim: e, groupController: d(t)}), t.AVChatRoomHandler = new Eu({
          tim: e,
          groupController: d(t)
        }), t._initListeners(), t
      }

      return c(o, n), i(o, [{
        key: "createGroup", value: function (e) {
          var n = this;
          if (!["Public", "Private", "ChatRoom", "AVChatRoom"].includes(e.type)) {
            var r = new lt({code: Ht, message: er});
            return Zo(r)
          }
          Ie(e.type) && !te(e.memberList) && e.memberList.length > 0 && (z.warn("GroupController.createGroup 创建AVChatRoom时不能添加群成员，自动忽略该字段"), e.memberList = void 0), Ce(e.type) || te(e.joinOption) || (z.warn("GroupController.createGroup 创建Private/ChatRoom/AVChatRoom群时不能设置字段：joinOption，自动忽略该字段"), e.joinOption = void 0);
          var o = new ui;
          o.setMethod(Si).setStart();
          var i = this.createPackage({name: "group", action: "create", param: e});
          return z.log("GroupController.createGroup."), this.tim.connectionController.request(i).then((function (r) {
            if (o.setCode(0).setNetworkType(n.getNetworkType()).setText("groupType=".concat(e.type, " groupID=").concat(r.data.groupID)).setEnd(), z.log("GroupController.createGroup ok. groupID:", r.data.groupID), e.type === t.GRP_AVCHATROOM) return n.getGroupProfile({groupID: r.data.groupID});
            n.updateGroupMap([u({}, e, {groupID: r.data.groupID})]);
            var i = n.tim.createCustomMessage({
              to: r.data.groupID,
              conversationType: t.CONV_GROUP,
              payload: {data: "group_create", extension: "".concat(n.tim.context.identifier, "创建群组")}
            });
            return n.tim.sendMessage(i), n.emitGroupListUpdate(), n.getGroupProfile({groupID: r.data.groupID})
          })).then((function (e) {
            var n = e.data.group;
            return n.selfInfo.messageRemindType = t.MSG_REMIND_ACPT_AND_NOTE, n.selfInfo.role = t.GRP_MBR_ROLE_OWNER, e
          })).catch((function (t) {
            return o.setText("groupType=".concat(e.type)), n.probeNetwork().then((function (e, n) {
              o.setError(t, e, n).setEnd()
            })), z.error("GroupController.createGroup error:", t), Zo(t)
          }))
        }
      }, {
        key: "joinGroup", value: function (e) {
          if (this.hasLocalGroup(e.groupID)) {
            var n = {status: t.JOIN_STATUS_ALREADY_IN_GROUP};
            return Qo(n)
          }
          if (e.type === t.GRP_PRIVATE) {
            var r = new lt({code: Bt, message: tr});
            return Zo(r)
          }
          return z.log("GroupController.joinGroup. groupID:", e.groupID), this.isLoggedIn() ? this.applyJoinGroup(e) : this.AVChatRoomHandler.joinWithoutAuth(e)
        }
      }, {
        key: "quitGroup", value: function (e) {
          var t = this;
          z.log("GroupController.quitGroup. groupID:", e);
          var n = this.AVChatRoomHandler.checkJoinedAVChatRoomByID(e);
          if (n && !this.isLoggedIn()) return z.log("GroupController.quitGroup anonymously ok. groupID:", e), this.deleteLocalGroupAndConversation(e), this.AVChatRoomHandler.reset(), Qo({groupID: e});
          var r = new ui;
          r.setMethod(ki).setStart();
          var o = this.createPackage({name: "group", action: "quitGroup", param: {groupID: e}});
          return this.tim.connectionController.request(o).then((function () {
            return r.setCode(0).setNetworkType(t.getNetworkType()).setText("groupID=".concat(e)).setEnd(), z.log("GroupController.quitGroup ok. groupID:", e), n && t.AVChatRoomHandler.reset(), t.deleteLocalGroupAndConversation(e), new Wo({groupID: e})
          })).catch((function (n) {
            return r.setText("groupID=".concat(e)), t.probeNetwork().then((function (e, t) {
              r.setError(n, e, t).setEnd()
            })), z.error("GroupController.quitGroup error.  error:".concat(n, ". groupID:").concat(e)), Zo(n)
          }))
        }
      }, {
        key: "changeGroupOwner", value: function (e) {
          var n = this;
          if (this.hasLocalGroup(e.groupID) && this.getLocalGroupProfile(e.groupID).type === t.GRP_AVCHATROOM) return Zo(new lt({
            code: Kt,
            message: nr
          }));
          if (e.newOwnerID === this.tim.loginInfo.identifier) return Zo(new lt({code: Vt, message: rr}));
          var r = new ui;
          r.setMethod(Ti).setStart();
          var o = this.createPackage({name: "group", action: "changeGroupOwner", param: e});
          return z.log("GroupController.changeGroupOwner. groupID:", e.groupID), this.tim.connectionController.request(o).then((function () {
            r.setCode(0).setNetworkType(n.getNetworkType()).setText("groupID=".concat(e.groupID)).setEnd(), z.log("GroupController.changeGroupOwner ok. groupID:", e.groupID);
            var t = e.groupID, o = e.newOwnerID;
            n.groupMap.get(t).ownerID = o;
            var i = n.groupMemberListMap.get(t);
            if (i instanceof Map) {
              var s = i.get(n.tim.loginInfo.identifier);
              te(s) || (s.updateRole("Member"), n.groupMap.get(t).selfInfo.role = "Member");
              var a = i.get(o);
              te(a) || a.updateRole("Owner")
            }
            return n.emitGroupListUpdate(!0, !1), new Wo({group: n.groupMap.get(t)})
          })).catch((function (t) {
            return r.setText("groupID=".concat(e.groupID)), n.probeNetwork().then((function (e, n) {
              r.setError(t, e, n).setEnd()
            })), z.error("GroupController.changeGroupOwner error:".concat(t, ". groupID:").concat(e.groupID)), Zo(t)
          }))
        }
      }, {
        key: "dismissGroup", value: function (e) {
          var n = this;
          if (this.hasLocalGroup(e) && this.getLocalGroupProfile(e).type === t.GRP_PRIVATE) return Zo(new lt({
            code: jt,
            message: or
          }));
          var r = new ui;
          r.setMethod(Ei).setStart();
          var o = this.createPackage({name: "group", action: "destroyGroup", param: {groupID: e}});
          return z.log("GroupController.dismissGroup. groupID:".concat(e)), this.tim.connectionController.request(o).then((function () {
            return r.setCode(0).setNetworkType(n.getNetworkType()).setText("groupID=".concat(e)).setEnd(), z.log("GroupController.dismissGroup ok. groupID:".concat(e)), n.deleteLocalGroupAndConversation(e), n.checkJoinedAVChatRoomByID(e) && n.AVChatRoomHandler.reset(), new Wo({groupID: e})
          })).catch((function (t) {
            return r.setText("groupID=".concat(e)), n.probeNetwork().then((function (e, n) {
              r.setError(t, e, n).setEnd()
            })), z.error("GroupController.dismissGroup error:".concat(t, ". groupID:").concat(e)), Zo(t)
          }))
        }
      }, {
        key: "updateGroupProfile", value: function (e) {
          var t = this;
          !this.hasLocalGroup(e.groupID) || Ce(this.getLocalGroupProfile(e.groupID).type) || te(e.joinOption) || (z.warn("GroupController.modifyGroup: Private/ChatRoom/AVChatRoom群不能设置字段：joinOption，自动忽略该字段"), e.joinOption = void 0);
          var n = new ui;
          n.setMethod(wi).setStart();
          var r = this.createPackage({name: "group", action: "updateGroupProfile", param: e});
          return z.log("GroupController.modifyGroup. groupID:", e.groupID), this.tim.connectionController.request(r).then((function () {
            (n.setCode(0).setNetworkType(t.getNetworkType()).setText("groupID=".concat(e.groupID)).setEnd(), z.log("GroupController.modifyGroup ok. groupID:", e.groupID), t.hasLocalGroup(e.groupID)) && (t.groupMap.get(e.groupID).updateGroup(e), t._setStorageGroupList());
            return new Wo({group: t.groupMap.get(e.groupID)})
          })).catch((function (r) {
            return n.setText("groupID=".concat(e.groupID)), t.probeNetwork().then((function (e, t) {
              n.setError(r, e, t).setEnd()
            })), z.log("GroupController.modifyGroup error. error:".concat(r, " groupID:").concat(e.groupID)), Zo(r)
          }))
        }
      }, {
        key: "setGroupMemberRole", value: function (e) {
          var n = this, r = e.groupID, o = e.userID, i = e.role, s = this.groupMap.get(r);
          if (s.selfInfo.role !== t.GRP_MBR_ROLE_OWNER) return Zo(new lt({code: Xt, message: cr}));
          if ([t.GRP_PRIVATE, t.GRP_AVCHATROOM].includes(s.type)) return Zo(new lt({code: Jt, message: lr}));
          if ([t.GRP_MBR_ROLE_ADMIN, t.GRP_MBR_ROLE_MEMBER].indexOf(i) < 0) return Zo(new lt({code: Qt, message: pr}));
          if (o === this.tim.loginInfo.identifier) return Zo(new lt({code: Zt, message: hr}));
          var a = new ui;
          return a.setMethod(bi).setStart(), a.setText("groupID=".concat(r, " userID=").concat(o, " role=").concat(i)), z.log("GroupController.setGroupMemberRole. groupID:".concat(r, ". userID: ").concat(o)), this._modifyGroupMemberInfo({
            groupID: r,
            userID: o,
            role: i
          }).then((function (e) {
            return a.setCode(0).setNetworkType(n.getNetworkType()).setEnd(), z.log("GroupController.setGroupMemberRole ok. groupID:".concat(r, ". userID: ").concat(o)), new Wo({
              group: s,
              member: e
            })
          })).catch((function (e) {
            return n.probeNetwork().then((function (t, n) {
              a.setError(e, t, n).setEnd()
            })), z.error("GroupController.setGroupMemberRole error:".concat(e, ". groupID:").concat(r, ". userID:").concat(o)), Zo(e)
          }))
        }
      }, {
        key: "setGroupMemberMuteTime", value: function (e) {
          var t = this, n = e.groupID, r = e.userID, o = e.muteTime;
          if (r === this.tim.loginInfo.identifier) return Zo(new lt({code: en, message: fr}));
          z.log("GroupController.setGroupMemberMuteTime. groupID:".concat(n, ". userID: ").concat(r));
          var i = new ui;
          return i.setMethod(Li).setStart(), i.setText("groupID=".concat(n, " userID=").concat(r, " muteTime=").concat(o)), this._modifyGroupMemberInfo({
            groupID: n,
            userID: r,
            muteTime: o
          }).then((function (e) {
            return i.setCode(0).setNetworkType(t.getNetworkType()).setEnd(), z.log("GroupController.setGroupMemberMuteTime ok. groupID:".concat(n, ". userID: ").concat(r)), new Wo({
              group: t.getLocalGroupProfile(n),
              member: e
            })
          })).catch((function (e) {
            return t.probeNetwork().then((function (t, n) {
              i.setError(e, t, n).setEnd()
            })), z.error("GroupController.setGroupMemberMuteTime error:".concat(e, ". groupID:").concat(n, ". userID:").concat(r)), Zo(e)
          }))
        }
      }, {
        key: "setMessageRemindType", value: function (e) {
          var t = this;
          z.log("GroupController.setMessageRemindType. groupID:".concat(e.groupID, ". userID: ").concat(e.userID || this.tim.loginInfo.identifier));
          var n = e.groupID, r = e.messageRemindType;
          return this._modifyGroupMemberInfo({
            groupID: n,
            messageRemindType: r,
            userID: this.tim.loginInfo.identifier
          }).then((function () {
            z.log("GroupController.setMessageRemindType ok. groupID:".concat(e.groupID, ". userID: ").concat(e.userID || t.tim.loginInfo.identifier));
            var n = t.getLocalGroupProfile(e.groupID);
            return n && (n.selfInfo.messageRemindType = r), new Wo({group: n})
          })).catch((function (n) {
            return z.error("GroupController.setMessageRemindType error:".concat(n, ". groupID:").concat(e.groupID, ". userID:").concat(e.userID || t.tim.loginInfo.identifier)), Zo(n)
          }))
        }
      }, {
        key: "setGroupMemberNameCard", value: function (e) {
          var t = this, n = e.groupID, r = e.userID, o = void 0 === r ? this.tim.loginInfo.identifier : r, i = e.nameCard;
          z.log("GroupController.setGroupMemberNameCard. groupID:".concat(n, ". userID: ").concat(o));
          var s = new ui;
          return s.setMethod(Pi).setStart(), s.setText("groupID=".concat(n, " userID=").concat(o, " nameCard=").concat(i)), this._modifyGroupMemberInfo({
            groupID: n,
            userID: o,
            nameCard: i
          }).then((function (e) {
            z.log("GroupController.setGroupMemberNameCard ok. groupID:".concat(n, ". userID: ").concat(o)), s.setCode(0).setNetworkType(t.getNetworkType()).setEnd();
            var r = t.getLocalGroupProfile(n);
            return o === t.tim.loginInfo.identifier && r && r.setSelfNameCard(i), new Wo({group: r, member: e})
          })).catch((function (e) {
            return t.probeNetwork().then((function (t, n) {
              s.setError(e, t, n).setEnd()
            })), z.error("GroupController.setGroupMemberNameCard error:".concat(e, ". groupID:").concat(n, ". userID:").concat(o)), Zo(e)
          }))
        }
      }, {
        key: "setGroupMemberCustomField", value: function (e) {
          var t = this, n = e.groupID, r = e.userID, o = void 0 === r ? this.tim.loginInfo.identifier : r,
            i = e.memberCustomField;
          z.log("GroupController.setGroupMemberCustomField. groupID:".concat(n, ". userID: ").concat(o));
          var s = new ui;
          return s.setMethod(Oi).setStart(), s.setText("groupID=".concat(n, " userID=").concat(o, " memberCustomField=").concat(i)), this._modifyGroupMemberInfo({
            groupID: n,
            userID: o,
            memberCustomField: i
          }).then((function (e) {
            return s.setCode(0).setNetworkType(t.getNetworkType()).setEnd(), z.log("GroupController.setGroupMemberCustomField ok. groupID:".concat(n, ". userID: ").concat(o)), new Wo({
              group: t.groupMap.get(n),
              member: e
            })
          })).catch((function (e) {
            return t.probeNetwork().then((function (t, n) {
              s.setError(e, t, n).setEnd()
            })), z.error("GroupController.setGroupMemberCustomField error:".concat(e, ". groupID:").concat(n, ". userID:").concat(o)), Zo(e)
          }))
        }
      }, {
        key: "getGroupList", value: function (e) {
          var t = this, n = new ui;
          n.setMethod(Ai).setStart(), z.log("GroupController.getGroupList");
          var r = {
            introduction: "Introduction",
            notification: "Notification",
            createTime: "CreateTime",
            ownerID: "Owner_Account",
            lastInfoTime: "LastInfoTime",
            memberNum: "MemberNum",
            maxMemberNum: "MaxMemberNum",
            joinOption: "ApplyJoinOption"
          }, o = ["Type", "Name", "FaceUrl", "NextMsgSeq", "LastMsgTime"];
          e && e.groupProfileFilter && e.groupProfileFilter.forEach((function (e) {
            r[e] && o.push(r[e])
          }));
          var i = this.createPackage({
            name: "group",
            action: "list",
            param: {responseFilter: {groupBaseInfoFilter: o, selfInfoFilter: ["Role", "JoinTime", "MsgFlag"]}}
          });
          return this.tim.connectionController.request(i).then((function (e) {
            var r = e.data.groups;
            return n.setCode(0).setNetworkType(t.getNetworkType()).setText(r.length).setEnd(), z.log("GroupController.getGroupList ok"), t._groupListTreeShaking(r), t.updateGroupMap(r), t.tempConversationList && (t._handleUpdateGroupLastMessage(t.tempConversationList), t.tempConversationList = null), t.emitGroupListUpdate(), new Wo({groupList: t.getLocalGroups()})
          })).catch((function (e) {
            return t.probeNetwork().then((function (t, r) {
              n.setError(e, t, r).setEnd()
            })), z.error("GroupController.getGroupList error: ", e), Zo(e)
          }))
        }
      }, {
        key: "getGroupMemberList", value: function (e) {
          var t = this, n = e.groupID, r = e.offset, o = void 0 === r ? 0 : r, i = e.count, s = void 0 === i ? 15 : i;
          z.log("GroupController.getGroupMemberList groupID: ".concat(n, " offset: ").concat(o, " count: ").concat(s));
          var a = this.createPackage({
            name: "group",
            action: "getGroupMemberList",
            param: {groupID: n, offset: o, limit: s > 100 ? 100 : s, memberInfoFilter: ["Role", "NameCard"]}
          }), u = [];
          return this.connectionController.request(a).then((function (e) {
            var r = e.data, o = r.members, i = r.memberNum;
            return ee(o) && 0 !== o.length ? (t.hasLocalGroup(n) && (t.getLocalGroupProfile(n).memberNum = i), u = t._updateLocalGroupMemberMap(n, o), t.tim.getUserProfile({
              userIDList: o.map((function (e) {
                return e.userID
              })), tagList: [Qe.NICK, Qe.AVATAR]
            })) : Promise.resolve([])
          })).then((function (e) {
            var r = e.data;
            if (!ee(r) || 0 === r.length) return Qo({memberList: []});
            var o = r.map((function (e) {
              return {userID: e.userID, nick: e.nick, avatar: e.avatar}
            }));
            return t._updateLocalGroupMemberMap(n, o), z.log("GroupController.getGroupMemberList ok."), new Wo({memberList: u})
          })).catch((function (e) {
            return z.error("GroupController.getGroupMemberList error: ", e), Zo(e)
          }))
        }
      }, {
        key: "getLocalGroups", value: function () {
          return v(this.groupMap.values())
        }
      }, {
        key: "getLocalGroupProfile", value: function (e) {
          return this.groupMap.get(e)
        }
      }, {
        key: "hasLocalGroup", value: function (e) {
          return this.groupMap.has(e)
        }
      }, {
        key: "getLocalGroupMemberInfo", value: function (e, t) {
          return this.groupMemberListMap.has(e) ? this.groupMemberListMap.get(e).get(t) : null
        }
      }, {
        key: "setLocalGroupMember", value: function (e, t) {
          if (this.groupMemberListMap.has(e)) this.groupMemberListMap.get(e).set(t.userID, t); else {
            var n = (new Map).set(t.userID, t);
            this.groupMemberListMap.set(e, n)
          }
        }
      }, {
        key: "hasLocalGroupMember", value: function (e, t) {
          return this.groupMemberListMap.has(e) && this.groupMemberListMap.get(e).has(t)
        }
      }, {
        key: "hasLocalGroupMemberMap", value: function (e) {
          return this.groupMemberListMap.has(e)
        }
      }, {
        key: "getGroupProfile", value: function (e) {
          var t = this;
          z.log("GroupController.getGroupProfile. groupID:", e.groupID);
          var n = e.groupID, r = e.groupCustomFieldFilter, o = {
            groupIDList: [n],
            responseFilter: {
              groupBaseInfoFilter: ["Type", "Name", "Introduction", "Notification", "FaceUrl", "Owner_Account", "CreateTime", "InfoSeq", "LastInfoTime", "LastMsgTime", "MemberNum", "MaxMemberNum", "ApplyJoinOption", "NextMsgSeq"],
              groupCustomFieldFilter: r
            }
          };
          return this.getGroupProfileAdvance(o).then((function (r) {
            var o, i = r.data, s = i.successGroupList, a = i.failureGroupList;
            return z.log("GroupController.getGroupProfile ok. groupID:", e.groupID), a.length > 0 ? Zo(a[0]) : (Ie(s[0].type) && !t.hasLocalGroup(n) ? o = new hu(s[0]) : (t.updateGroupMap(s), o = t.getLocalGroupProfile(n)), o && o.selfInfo && !o.selfInfo.nameCard ? t.updateSelfInfo(o).then((function (e) {
              return new Wo({group: e})
            })) : new Wo({group: o}))
          })).catch((function (t) {
            return z.error("GroupController.getGroupProfile error:".concat(t, ". groupID:").concat(e.groupID)), Zo(t)
          }))
        }
      }, {
        key: "getGroupMemberProfile", value: function (e) {
          var t = this;
          z.log("GroupController.getGroupMemberProfile groupID:".concat(e.groupID, " userIDList:").concat(e.userIDList.join(","))), e.userIDList.length > 50 && (e.userIDList = e.userIDList.slice(0, 50));
          var n = e.groupID, r = e.userIDList;
          return this._getGroupMemberProfileAdvance(u({}, e, {userIDList: r})).then((function (e) {
            var r = e.data.members;
            return ee(r) && 0 !== r.length ? (t._updateLocalGroupMemberMap(n, r), t.tim.getUserProfile({
              userIDList: r.map((function (e) {
                return e.userID
              })), tagList: [Qe.NICK, Qe.AVATAR]
            })) : Qo([])
          })).then((function (e) {
            var o = e.data.map((function (e) {
              return {userID: e.userID, nick: e.nick, avatar: e.avatar}
            }));
            t._updateLocalGroupMemberMap(n, o);
            var i = r.filter((function (e) {
              return t.hasLocalGroupMember(n, e)
            })).map((function (e) {
              return t.getLocalGroupMemberInfo(n, e)
            }));
            return new Wo({memberList: i})
          }))
        }
      }, {
        key: "_getGroupMemberProfileAdvance", value: function (e) {
          var t = this.createPackage({
            name: "group",
            action: "getGroupMemberProfile",
            param: u({}, e, {memberInfoFilter: e.memberInfoFilter ? e.memberInfoFilter : ["Role", "JoinTime", "NameCard", "ShutUpUntil"]})
          });
          return this.connectionController.request(t)
        }
      }, {
        key: "updateSelfInfo", value: function (e) {
          var t = e.groupID;
          z.log("GroupController.updateSelfInfo groupID:", t);
          var n = {groupID: t, userIDList: [this.tim.loginInfo.identifier]};
          return this.getGroupMemberProfile(n).then((function (n) {
            var r = n.data.memberList;
            return z.log("GroupController.updateSelfInfo ok. groupID:", t), e && 0 !== r.length && e.updateSelfInfo(r[0]), e
          }))
        }
      }, {
        key: "addGroupMember", value: function (e) {
          var t = this.getLocalGroupProfile(e.groupID);
          if (Ie(t.type)) {
            var n = new lt({code: Yt, message: sr});
            return Zo(n)
          }
          e.userIDList = e.userIDList.map((function (e) {
            return {userID: e}
          }));
          var r = this.createPackage({name: "group", action: "addGroupMember", param: e});
          return z.log("GroupController.addGroupMember. groupID:", e.groupID), this.connectionController.request(r).then((function (n) {
            var r = n.data.members;
            z.log("GroupController.addGroupMember ok. groupID:", e.groupID);
            var o = r.filter((function (e) {
              return 1 === e.result
            })).map((function (e) {
              return e.userID
            })), i = r.filter((function (e) {
              return 0 === e.result
            })).map((function (e) {
              return e.userID
            })), s = r.filter((function (e) {
              return 2 === e.result
            })).map((function (e) {
              return e.userID
            }));
            return 0 === o.length ? new Wo({
              successUserIDList: o,
              failureUserIDList: i,
              existedUserIDList: s
            }) : (t.memberNum += o.length, new Wo({
              successUserIDList: o,
              failureUserIDList: i,
              existedUserIDList: s,
              group: t
            }))
          })).catch((function (t) {
            return z.error("GroupController.addGroupMember error:".concat(t, ", groupID:").concat(e.groupID)), Zo(t)
          }))
        }
      }, {
        key: "deleteGroupMember", value: function (e) {
          var n = this;
          z.log("GroupController.deleteGroupMember groupID:".concat(e.groupID, " userIDList:").concat(e.userIDList));
          var r = this.getLocalGroupProfile(e.groupID);
          if (r.type === t.GRP_AVCHATROOM) return Zo(new lt({code: Wt, message: ur}));
          var o = this.createPackage({name: "group", action: "deleteGroupMember", param: e});
          return this.connectionController.request(o).then((function () {
            return z.log("GroupController.deleteGroupMember ok"), r.memberNum--, n.deleteLocalGroupMembers(e.groupID, e.userIDList), new Wo({
              group: r,
              userIDList: e.userIDList
            })
          })).catch((function (t) {
            return z.error("GroupController.deleteGroupMember error:".concat(t.code, ", groupID:").concat(e.groupID)), Zo(t)
          }))
        }
      }, {
        key: "searchGroupByID", value: function (e) {
          var t = {groupIDList: [e]}, n = this.createPackage({name: "group", action: "searchGroupByID", param: t});
          return z.log("GroupController.searchGroupByID. groupID:".concat(e)), this.connectionController.request(n).then((function (t) {
            var n = t.data.groupProfile;
            if (z.log("GroupController.searchGroupByID ok. groupID:".concat(e)), n[0].errorCode !== Re.SUCCESS) throw new lt({
              code: n[0].errorCode,
              message: n[0].errorInfo
            });
            return new Wo({group: new hu(n[0])})
          })).catch((function (t) {
            return z.error("GroupController.searchGroupByID error:".concat(t, ", groupID:").concat(e)), Zo(t)
          }))
        }
      }, {
        key: "applyJoinGroup", value: function (e) {
          var t = this, n = new ui;
          n.setMethod(Di).setStart();
          var r = this.createPackage({name: "group", action: "applyJoinGroup", param: e});
          return this.connectionController.request(r).then((function (r) {
            var o = r.data, i = o.joinedStatus, s = o.longPollingKey;
            switch (n.setCode(0).setNetworkType(t.getNetworkType()).setText("groupID=".concat(e.groupID, " joinedStatus=").concat(i)).setEnd(), z.log("GroupController.joinGroup ok. groupID:", e.groupID), i) {
              case Ae.WAIT_APPROVAL:
                return new Wo({status: Ae.WAIT_APPROVAL});
              case Ae.SUCCESS:
                return t.getGroupProfile({groupID: e.groupID}).then((function (n) {
                  var r = n.data.group, o = {status: Ae.SUCCESS, group: r};
                  return te(s) ? new Wo(o) : (t.tim.innerEmitter.emit(qo, {data: e.groupID}), t.AVChatRoomHandler.startRunLoop({
                    longPollingKey: s,
                    group: r
                  }))
                }));
              default:
                var a = new lt({code: $t, message: ir});
                return z.error("GroupController.joinGroup error:".concat(a, ". groupID:").concat(e.groupID)), Zo(a)
            }
          })).catch((function (r) {
            return n.setText("groupID=".concat(e.groupID)), t.probeNetwork().then((function (e, t) {
              n.setError(r, e, t).setEnd()
            })), z.error("GroupController.joinGroup error:".concat(r, ". groupID:").concat(e.groupID)), Zo(r)
          }))
        }
      }, {
        key: "applyJoinAVChatRoom", value: function (e) {
          return this.AVChatRoomHandler.applyJoinAVChatRoom(e)
        }
      }, {
        key: "handleGroupApplication", value: function (e) {
          var t = this, n = e.message.payload, r = n.groupProfile.groupID, o = n.authentication, i = n.messageKey,
            s = n.operatorID, a = this.createPackage({
              name: "group",
              action: "handleApplyJoinGroup",
              param: u({}, e, {applicant: s, groupID: r, authentication: o, messageKey: i})
            });
          return z.log("GroupController.handleApplication. groupID:", r), this.connectionController.request(a).then((function () {
            return z.log("GroupController.handleApplication ok. groupID:", r), t.deleteGroupSystemNotice({messageList: [e.message]}), new Wo({group: t.getLocalGroupProfile(r)})
          })).catch((function (e) {
            return z.error("GroupController.handleApplication error.  error:".concat(e, ". groupID:").concat(r)), Zo(e)
          }))
        }
      }, {
        key: "deleteGroupSystemNotice", value: function (e) {
          var n = this;
          if (!ee(e.messageList) || 0 === e.messageList.length) return Qo();
          z.log("GroupController.deleteGroupSystemNotice " + e.messageList.map((function (e) {
            return e.ID
          })));
          var r = this.createPackage({
            name: "group",
            action: "deleteGroupSystemNotice",
            param: {
              messageListToDelete: e.messageList.map((function (e) {
                return {from: t.CONV_SYSTEM, messageSeq: e.clientSequence, messageRandom: e.random}
              }))
            }
          });
          return this.connectionController.request(r).then((function () {
            return z.log("GroupController.deleteGroupSystemNotice ok"), e.messageList.forEach((function (e) {
              n.tim.messageController.deleteLocalMessage(e)
            })), new Wo
          })).catch((function (e) {
            return z.error("GroupController.deleteGroupSystemNotice error:", e), Zo(e)
          }))
        }
      }, {
        key: "getGroupProfileAdvance", value: function (e) {
          ee(e.groupIDList) && e.groupIDList.length > 50 && (z.warn("GroupController.getGroupProfileAdvance 获取群资料的数量不能超过50个"), e.groupIDList.length = 50), z.log("GroupController.getGroupProfileAdvance. groupIDList:", e.groupIDList);
          var t = this.createPackage({name: "group", action: "query", param: e});
          return this.tim.connectionController.request(t).then((function (e) {
            z.log("GroupController.getGroupProfileAdvance ok.");
            var t = e.data.groups, n = t.filter((function (e) {
              return te(e.errorCode) || e.errorCode === Re.SUCCESS
            })), r = t.filter((function (e) {
              return e.errorCode && e.errorCode !== Re.SUCCESS
            })).map((function (e) {
              return new lt({code: Number("500".concat(e.errorCode)), message: e.errorInfo, data: {groupID: e.groupID}})
            }));
            return new Wo({successGroupList: n, failureGroupList: r})
          })).catch((function (t) {
            return z.error("GroupController.getGroupProfile error:".concat(t, ". groupID:").concat(e.groupID)), Zo(t)
          }))
        }
      }, {
        key: "_deleteLocalGroup", value: function (e) {
          return this.groupMap.delete(e), this.groupMemberListMap.delete(e), this._setStorageGroupList(), this.groupMap.has(e) && this.groupMemberListMap.has(e)
        }
      }, {
        key: "_initGroupList", value: function () {
          var e = this, t = new ui;
          t.setMethod(Ri).setStart(), z.time(si), z.log("GroupController._initGroupList");
          var n = this._getStorageGroupList();
          ee(n) && n.length > 0 ? (n.forEach((function (t) {
            e.groupMap.set(t.groupID, new hu(t))
          })), this.emitGroupListUpdate(!0, !1), t.setCode(0).setNetworkType(this.getNetworkType()).setText(this.groupMap.size).setEnd()) : t.setCode(0).setNetworkType(this.getNetworkType()).setText(0).setEnd(), this.triggerReady(), z.log("GroupController._initGroupList ok. initCost=".concat(z.timeEnd(si), "ms")), this.getGroupList()
        }
      }, {
        key: "_initListeners", value: function () {
          var e = this.tim.innerEmitter;
          e.once(zr, this._initGroupList, this), e.on(Oo, this._handleUpdateGroupLastMessage, this), e.on(ro, this._handleReceivedGroupMessage, this), e.on(Uo, this._handleProfileUpdated, this)
        }
      }, {
        key: "emitGroupListUpdate", value: function () {
          var t = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0],
            n = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1], r = this.getLocalGroups();
          n && this.tim.innerEmitter.emit(Eo, r), t && this.tim.outerEmitter.emit(e.GROUP_LIST_UPDATED, r)
        }
      }, {
        key: "_handleReceivedGroupMessage", value: function (e) {
          var n = this, r = e.data.eventDataList;
          Array.isArray(r) && r.forEach((function (e) {
            var r = e.conversationID.replace(t.CONV_GROUP, "");
            n.groupMap.has(r) && (n.groupMap.get(r).nextMessageSeq = e.lastMessage.sequence + 1)
          }))
        }
      }, {
        key: "_onReceivedGroupSystemNotice", value: function (e) {
          var t = e.data;
          this.groupNoticeHandler._onReceivedGroupNotice(t)
        }
      }, {
        key: "_handleUpdateGroupLastMessage", value: function (e) {
          if (0 !== this.groupMap.size) {
            for (var n = !1, r = 0; r < e.length; r++) {
              var o = e[r], i = o.type === t.CONV_GROUP;
              if (o.conversationID && i) {
                var s = o.conversationID.split(/^GROUP/)[1], a = this.getLocalGroupProfile(s);
                a && (a.lastMessage = o.lastMessage, n = !0)
              }
            }
            n && (this.groupMap = this._sortLocalGroupList(this.groupMap), this.emitGroupListUpdate(!0, !1))
          } else this.tempConversationList = e
        }
      }, {
        key: "_sortLocalGroupList", value: function (e) {
          var t = v(e).filter((function (e) {
            var t = y(e, 2);
            t[0];
            return !Te(t[1].lastMessage)
          }));
          return t.sort((function (e, t) {
            return t[1].lastMessage.lastTime - e[1].lastMessage.lastTime
          })), new Map([].concat(v(t), v(e)))
        }
      }, {
        key: "_getStorageGroupList", value: function () {
          return this.tim.storage.getItem("groupMap")
        }
      }, {
        key: "_setStorageGroupList", value: function () {
          var e = this.getLocalGroups().filter((function (e) {
            var t = e.type;
            return !Ie(t)
          })).slice(0, 20).map((function (e) {
            return {groupID: e.groupID, name: e.name, avatar: e.avatar, type: e.type}
          }));
          this.tim.storage.setItem("groupMap", e)
        }
      }, {
        key: "updateGroupMap", value: function (e) {
          var t = this;
          e.forEach((function (e) {
            t.groupMap.has(e.groupID) ? t.groupMap.get(e.groupID).updateGroup(e) : t.groupMap.set(e.groupID, new hu(e))
          })), this._setStorageGroupList()
        }
      }, {
        key: "_updateLocalGroupMemberMap", value: function (e, t) {
          var n = this;
          return ee(t) && 0 !== t.length ? t.map((function (t) {
            return n.hasLocalGroupMember(e, t.userID) ? n.getLocalGroupMemberInfo(e, t.userID).updateMember(t) : n.setLocalGroupMember(e, new Su(t)), n.getLocalGroupMemberInfo(e, t.userID)
          })) : []
        }
      }, {
        key: "deleteLocalGroupMembers", value: function (e, t) {
          var n = this.groupMemberListMap.get(e);
          n && t.forEach((function (e) {
            n.delete(e)
          }))
        }
      }, {
        key: "_modifyGroupMemberInfo", value: function (e) {
          var t = this, n = e.groupID, r = e.userID,
            o = this.createPackage({name: "group", action: "modifyGroupMemberInfo", param: e});
          return this.tim.connectionController.request(o).then((function () {
            if (t.hasLocalGroupMember(n, r)) {
              var o = t.getLocalGroupMemberInfo(n, r);
              return te(e.muteTime) || o.updateMuteUntil(e.muteTime), te(e.role) || o.updateRole(e.role), te(e.nameCard) || o.updateNameCard(e.nameCard), te(e.memberCustomField) || o.updateMemberCustomField(e.memberCustomField), o
            }
            return t.getGroupMemberProfile({groupID: n, userIDList: [r]}).then((function (e) {
              return y(e.data.memberList, 1)[0]
            }))
          }))
        }
      }, {
        key: "_groupListTreeShaking", value: function (e) {
          for (var t = new Map(v(this.groupMap)), n = 0, r = e.length; n < r; n++) t.delete(e[n].groupID);
          this.AVChatRoomHandler.hasJoinedAVChatRoom() && t.delete(this.AVChatRoomHandler.group.groupID);
          for (var o = v(t.keys()), i = 0, s = o.length; i < s; i++) this.groupMap.delete(o[i])
        }
      }, {
        key: "_handleProfileUpdated", value: function (e) {
          for (var t = this, n = e.data, r = function (e) {
            var r = n[e];
            t.groupMemberListMap.forEach((function (e) {
              e.has(r.userID) && e.get(r.userID).updateMember({nick: r.nick, avatar: r.avatar})
            }))
          }, o = 0; o < n.length; o++) r(o)
        }
      }, {
        key: "getJoinedAVChatRoom", value: function () {
          return this.AVChatRoomHandler.getJoinedAVChatRoom()
        }
      }, {
        key: "deleteLocalGroupAndConversation", value: function (e) {
          this._deleteLocalGroup(e), this.tim.conversationController.deleteLocalConversation("GROUP".concat(e)), this.emitGroupListUpdate(!0, !1)
        }
      }, {
        key: "checkJoinedAVChatRoomByID", value: function (e) {
          return this.AVChatRoomHandler.checkJoinedAVChatRoomByID(e)
        }
      }, {
        key: "reset", value: function () {
          this.groupMap.clear(), this.groupMemberListMap.clear(), this.resetReady(), this.groupNoticeHandler.reset(), this.AVChatRoomHandler.reset(), this.tim.innerEmitter.once(zr, this._initGroupList, this)
        }
      }]), o
    }($o), Au = function () {
      for (var e = [], t = Ru(arguments), n = 0; n < arguments.length; n++) Number.isInteger(arguments[n]) ? e.push(arguments[n]) : e.push(!0 == !!arguments[n] ? "1" : "0");
      return e.join(t)
    }, Ru = function (e) {
      var t = e.length, n = e[t - 1];
      if ("string" != typeof n) return "";
      if (n.length > 1) return "";
      var r = e[t - 1];
      return delete e[t - 1], e.length -= t === e.length ? 1 : 0, r
    }, Lu = function (e) {
      function t(e) {
        var n;
        return r(this, t), (n = m(this, l(t).call(this, e)))._initializeMembers(), n.tim.innerEmitter.on(Ao, (function () {
          n._initializeStatus(), n._bindListener()
        })), n.tim.innerEmitter.on(Ro, (function () {
          n._initializeStatus(), n._unbindListener()
        })), n
      }

      return c(t, e), i(t, [{
        key: "_initializeMembers", value: function () {
          this.normalTimeout = 300, this.realtimeNoticeTimeout = 11e4, this.channelMaxTimeout = 3e5
        }
      }, {
        key: "_initializeStatus", value: function () {
          this._initializeAccountStatus(), this._initializeChannelStatus()
        }
      }, {
        key: "_initializeAccountStatus", value: function () {
          this.accountStatus = {lastSignInTime: 0, status: be.SIGN_OUT}
        }
      }, {
        key: "_initializeChannelStatus", value: function () {
          this.channelStatus = {
            startTime: 0,
            offlineTime: 0,
            failCount: 0,
            lastRequestTime: 0,
            lastJitterTime: 0,
            jitterCount: 0,
            jitters: [],
            status: Oe.OFFLINE
          }
        }
      }, {
        key: "getChannelStatus", value: function () {
          return this.channelStatus.status
        }
      }, {
        key: "_channelStatusJittersUpdate", value: function (e) {
          this.channelStatus.jitterCount++, this.channelStatus.lastJitterTime = e, this.channelStatus.jitters.push(e), this.channelStatus.jitters.length > 5 && this.channelStatus.jitters.pop()
        }
      }, {
        key: "_bindListener", value: function () {
          var e = this.tim.innerEmitter;
          e.on(so, this._onChannelStart, this), e.on(ao, this._onChannelRequestSuccess, this), e.on(uo, this._onChannelFail, this), e.on(co, this._onChannelResponseError, this)
        }
      }, {
        key: "_unbindListener", value: function () {
          var e = this.tim.innerEmitter;
          e.off(so, this._onChannelStart, this), e.off(ao, this._onChannelRequestSuccess, this), e.off(uo, this._onChannelFail, this), e.off(co, this._onChannelResponseError, this)
        }
      }, {
        key: "_onChannelStart", value: function () {
          this.channelStatus.startTime = +new Date, this.channelStatus.status = Oe.ONLINE
        }
      }, {
        key: "_onChannelRequestSuccess", value: function () {
          var e = this.tim.innerEmitter, t = Date.now(),
            n = t - (this.channelStatus.lastRequestTime > 0 ? this.channelStatus.lastRequestTime : Date.now() + 100),
            r = Au(n < this.realtimeNoticeTimeout, n < this.channelMaxTimeout);
          switch (this.channelStatus.status = Oe.ONLINE, this.channelStatus.failCount = 0, r) {
            case"11":
              break;
            case"01":
              e.emit(lo);
              break;
            case"00":
              e.emit(po)
          }
          this.channelStatus.lastRequestTime = t
        }
      }, {
        key: "_onChannelFail", value: function (e) {
          var t = this.tim.innerEmitter, n = Date.now();
          this.channelStatus.status = Oe.OFFLINE;
          var r = n - (0 === this.channelStatus.offlineTime ? this.channelStatus.lastRequestTime : this.channelStatus.offlineTime);
          this.channelStatus.offlineTime = n, this.channelStatus.failCount++, z.log("_onChannelFail count : ".concat(this.channelStatus.failCount, "  time diff: ").concat(r, ";")), this.channelStatus.failCount > 5 && r < 5e3 && (t.emit(ho), z.error("Detected notice channel offline, please check your network!"))
        }
      }, {
        key: "_onChannelResponseError", value: function (e) {
          if (e instanceof lt) {
            var t = this.tim.innerEmitter;
            switch (this.channelStatus.status = Oe.OFFLINE, e.code) {
              case Cn:
              case In:
                t.emit(Po), t.emit(ho);
                break;
              case Sn:
                z.error(e.code, e.message);
                break;
              default:
                t.emit(bo, e)
            }
          } else z.warn("StatusController._onChannelResponseError: Unhandled error ".concat(e.message, ":"))
        }
      }]), t
    }($o);

  function Pu() {
    return null
  }

  var bu = function () {
    function e(t) {
      r(this, e), this.tim = t, this.isWX = E, this.storageQueue = new Map, this.checkTimes = 0, this.checkTimer = setInterval(this._onCheckTimer.bind(this), 1e3), this._errorTolerantHandle()
    }

    return i(e, [{
      key: "_errorTolerantHandle", value: function () {
        !this.isWX && te(window.localStorage) && (this.getItem = Pu, this.setItem = Pu, this.removeItem = Pu, this.clear = Pu)
      }
    }, {
      key: "_onCheckTimer", value: function () {
        if (this.checkTimes++, this.checkTimes % 20 == 0) {
          if (0 === this.storageQueue.size) return;
          this._doFlush()
        }
      }
    }, {
      key: "_doFlush", value: function () {
        try {
          var e = !0, t = !1, n = void 0;
          try {
            for (var r, o = this.storageQueue[Symbol.iterator](); !(e = (r = o.next()).done); e = !0) {
              var i = y(r.value, 2), s = i[0], a = i[1];
              this.isWX ? wx.setStorageSync(this._getKey(s), a) : localStorage.setItem(this._getKey(s), JSON.stringify(a))
            }
          } catch (u) {
            t = !0, n = u
          } finally {
            try {
              e || null == o.return || o.return()
            } finally {
              if (t) throw n
            }
          }
          this.storageQueue.clear()
        } catch (c) {
          z.warn("Storage._doFlush error", c)
        }
      }
    }, {
      key: "_getPrefix", value: function () {
        var e = this.tim.loginInfo, t = e.SDKAppID, n = e.identifier;
        return "TIM_".concat(t, "_").concat(n, "_")
      }
    }, {
      key: "getItem", value: function (e) {
        var t = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1];
        try {
          var n = t ? this._getKey(e) : e;
          return this.isWX ? wx.getStorageSync(n) : JSON.parse(localStorage.getItem(n))
        } catch (r) {
          z.warn("Storage.getItem error:", r)
        }
      }
    }, {
      key: "setItem", value: function (e, t) {
        var n = arguments.length > 2 && void 0 !== arguments[2] && arguments[2],
          r = !(arguments.length > 3 && void 0 !== arguments[3]) || arguments[3];
        if (n) {
          var o = r ? this._getKey(e) : e;
          this.isWX ? wx.setStorageSync(o, t) : localStorage.setItem(o, JSON.stringify(t))
        } else this.storageQueue.set(e, t)
      }
    }, {
      key: "clear", value: function () {
        try {
          this.isWX ? wx.clearStorageSync() : localStorage.clear()
        } catch (e) {
          z.warn("Storage.clear error:", e)
        }
      }
    }, {
      key: "removeItem", value: function (e) {
        var t = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1];
        try {
          var n = t ? this._getKey(e) : e;
          this.isWX ? wx.removeStorageSync(n) : localStorage.removeItem(n)
        } catch (r) {
          z.warn("Storage.removeItem error:", r)
        }
      }
    }, {
      key: "getSize", value: function (e) {
        var t = this, n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "b";
        try {
          var r = {size: 0, limitSize: 5242880, unit: n};
          if (Object.defineProperty(r, "leftSize", {
            enumerable: !0, get: function () {
              return r.limitSize - r.size
            }
          }), this.isWX && (r.limitSize = 1024 * wx.getStorageInfoSync().limitSize), e) r.size = JSON.stringify(this.getItem(e)).length + this._getKey(e).length; else if (this.isWX) {
            var o = wx.getStorageInfoSync(), i = o.keys;
            i.forEach((function (e) {
              r.size += JSON.stringify(wx.getStorageSync(e)).length + t._getKey(e).length
            }))
          } else for (var s in localStorage) localStorage.hasOwnProperty(s) && (r.size += localStorage.getItem(s).length + s.length);
          return this._convertUnit(r)
        } catch (a) {
          z.warn("Storage.getSize error:", a)
        }
      }
    }, {
      key: "_convertUnit", value: function (e) {
        var t = {}, n = e.unit;
        for (var r in t.unit = n, e) "number" == typeof e[r] && ("kb" === n.toLowerCase() ? t[r] = Math.round(e[r] / 1024) : "mb" === n.toLowerCase() ? t[r] = Math.round(e[r] / 1024 / 1024) : t[r] = e[r]);
        return t
      }
    }, {
      key: "_getKey", value: function (e) {
        return "".concat(this._getPrefix()).concat(e)
      }
    }, {
      key: "reset", value: function () {
        this._doFlush(), this.checkTimes = 0
      }
    }]), e
  }(), Ou = C((function (e) {
    var t = Object.prototype.hasOwnProperty, n = "~";

    function r() {
    }

    function o(e, t, n) {
      this.fn = e, this.context = t, this.once = n || !1
    }

    function i(e, t, r, i, s) {
      if ("function" != typeof r) throw new TypeError("The listener must be a function");
      var a = new o(r, i || e, s), u = n ? n + t : t;
      return e._events[u] ? e._events[u].fn ? e._events[u] = [e._events[u], a] : e._events[u].push(a) : (e._events[u] = a, e._eventsCount++), e
    }

    function s(e, t) {
      0 == --e._eventsCount ? e._events = new r : delete e._events[t]
    }

    function a() {
      this._events = new r, this._eventsCount = 0
    }

    Object.create && (r.prototype = Object.create(null), (new r).__proto__ || (n = !1)), a.prototype.eventNames = function () {
      var e, r, o = [];
      if (0 === this._eventsCount) return o;
      for (r in e = this._events) t.call(e, r) && o.push(n ? r.slice(1) : r);
      return Object.getOwnPropertySymbols ? o.concat(Object.getOwnPropertySymbols(e)) : o
    }, a.prototype.listeners = function (e) {
      var t = n ? n + e : e, r = this._events[t];
      if (!r) return [];
      if (r.fn) return [r.fn];
      for (var o = 0, i = r.length, s = new Array(i); o < i; o++) s[o] = r[o].fn;
      return s
    }, a.prototype.listenerCount = function (e) {
      var t = n ? n + e : e, r = this._events[t];
      return r ? r.fn ? 1 : r.length : 0
    }, a.prototype.emit = function (e, t, r, o, i, s) {
      var a = n ? n + e : e;
      if (!this._events[a]) return !1;
      var u, c, l = this._events[a], p = arguments.length;
      if (l.fn) {
        switch (l.once && this.removeListener(e, l.fn, void 0, !0), p) {
          case 1:
            return l.fn.call(l.context), !0;
          case 2:
            return l.fn.call(l.context, t), !0;
          case 3:
            return l.fn.call(l.context, t, r), !0;
          case 4:
            return l.fn.call(l.context, t, r, o), !0;
          case 5:
            return l.fn.call(l.context, t, r, o, i), !0;
          case 6:
            return l.fn.call(l.context, t, r, o, i, s), !0
        }
        for (c = 1, u = new Array(p - 1); c < p; c++) u[c - 1] = arguments[c];
        l.fn.apply(l.context, u)
      } else {
        var h, f = l.length;
        for (c = 0; c < f; c++) switch (l[c].once && this.removeListener(e, l[c].fn, void 0, !0), p) {
          case 1:
            l[c].fn.call(l[c].context);
            break;
          case 2:
            l[c].fn.call(l[c].context, t);
            break;
          case 3:
            l[c].fn.call(l[c].context, t, r);
            break;
          case 4:
            l[c].fn.call(l[c].context, t, r, o);
            break;
          default:
            if (!u) for (h = 1, u = new Array(p - 1); h < p; h++) u[h - 1] = arguments[h];
            l[c].fn.apply(l[c].context, u)
        }
      }
      return !0
    }, a.prototype.on = function (e, t, n) {
      return i(this, e, t, n, !1)
    }, a.prototype.once = function (e, t, n) {
      return i(this, e, t, n, !0)
    }, a.prototype.removeListener = function (e, t, r, o) {
      var i = n ? n + e : e;
      if (!this._events[i]) return this;
      if (!t) return s(this, i), this;
      var a = this._events[i];
      if (a.fn) a.fn !== t || o && !a.once || r && a.context !== r || s(this, i); else {
        for (var u = 0, c = [], l = a.length; u < l; u++) (a[u].fn !== t || o && !a[u].once || r && a[u].context !== r) && c.push(a[u]);
        c.length ? this._events[i] = 1 === c.length ? c[0] : c : s(this, i)
      }
      return this
    }, a.prototype.removeAllListeners = function (e) {
      var t;
      return e ? (t = n ? n + e : e, this._events[t] && s(this, t)) : (this._events = new r, this._eventsCount = 0), this
    }, a.prototype.off = a.prototype.removeListener, a.prototype.addListener = a.prototype.on, a.prefixed = n, a.EventEmitter = a, e.exports = a
  })), Nu = function (e) {
    var t, n, r, o, i;
    return Te(e.context) ? (t = "", n = 0, r = 0, o = 0, i = 1) : (t = e.context.a2Key, n = e.context.tinyID, r = e.context.SDKAppID, o = e.context.contentType, i = e.context.apn), {
      platform: Hr,
      websdkappid: Fr,
      v: xr,
      a2: t,
      tinyid: n,
      sdkappid: r,
      contentType: o,
      apn: i,
      reqtime: function () {
        return +new Date
      }
    }
  }, Gu = function () {
    function e(t) {
      r(this, e), this.isReady = !1, this.tim = t, this.context = t.context, this._initList(), this._updateWhenCTXIsReady()
    }

    return i(e, [{
      key: "_updateWhenCTXIsReady", value: function () {
        this.tim.innerEmitter.on($r, this.update, this), this.tim.innerEmitter.on(Yr, this.reset, this)
      }
    }, {
      key: "update", value: function (e) {
        var t = e.context;
        this.context = t, this._initList()
      }
    }, {
      key: "reset", value: function (e) {
        this.context = e.data, this._initList()
      }
    }, {
      key: "get", value: function (e) {
        var t = e.name, r = e.action, o = e.param, i = e.tjgID;
        if (void 0 === this.config[t]) throw new lt({code: hn, message: "".concat(Ir, ": PackageConfig.").concat(t)});
        if (void 0 === this.config[t][r]) throw new lt({
          code: hn,
          message: "".concat(Ir, ": PackageConfig.").concat(t, ".").concat(r)
        });
        var s = function e(t) {
          if (0 === Object.getOwnPropertyNames(t).length) return Object.create(null);
          var r = Array.isArray(t) ? [] : Object.create(null), o = "";
          for (var i in t) null !== t[i] ? void 0 !== t[i] ? (o = n(t[i]), ["string", "number", "function", "boolean"].indexOf(o) >= 0 ? r[i] = t[i] : r[i] = e(t[i])) : r[i] = void 0 : r[i] = null;
          return r
        }(this.config[t][r]);
        return s.requestData = this._initRequestData(o, s), s.encode = this._initEncoder(s), s.decode = this._initDecoder(s), i && (s.queryString.tjg_id = i), s
      }
    }, {
      key: "set", value: function (e) {
        var t = e.key, r = e.value;
        if (!1 != !!t) {
          var o = t.split(".");
          if (!(o.length <= 0)) {
            !function e(t, r, o, i) {
              var s = r[o];
              "object" === n(t[s]) ? e(t[s], r, o + 1, i) : t[s] = i
            }(this.config, o, 0, r)
          }
        }
      }
    }, {
      key: "_initList", value: function () {
        var e;
        this.config = {}, this.config.accessLayer = (e = this.tim, {
          create: null,
          query: {
            serverName: Vr.NAME.WEB_IM,
            cmd: Vr.CMD.ACCESS_LAYER,
            channel: Vr.CHANNEL.XHR,
            protocol: Kr,
            method: "POST",
            queryString: {
              platform: Hr,
              identifier: e.loginInfo.identifier,
              usersig: e.loginInfo.userSig,
              contentType: e.loginInfo.contentType,
              apn: null !== e.context ? e.context.apn : 1,
              websdkappid: Fr,
              v: xr
            },
            requestData: {}
          },
          update: null,
          delete: null
        }), this.config.login = function (e) {
          return {
            create: null,
            query: {
              serverName: Vr.NAME.OPEN_IM,
              cmd: Vr.CMD.LOGIN,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              method: "POST",
              queryString: {
                websdkappid: Fr,
                v: xr,
                platform: Hr,
                identifier: e.loginInfo.identifier,
                usersig: e.loginInfo.userSig,
                sdkappid: e.loginInfo.SDKAppID,
                accounttype: e.loginInfo.accountType,
                contentType: null !== e.context ? e.context.contentType : 0,
                apn: null !== e.context ? e.context.apn : 1,
                reqtime: +new Date / 1e3
              },
              requestData: {state: "Online"},
              keyMaps: {request: {tinyID: "tinyId"}, response: {TinyId: "tinyID"}}
            },
            update: null,
            delete: null
          }
        }(this.tim), this.config.logout = function (e) {
          return {
            create: null,
            query: {
              serverName: Vr.NAME.OPEN_IM,
              cmd: Vr.CMD.LOGOUT_ALL,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              method: "POST",
              queryString: {
                websdkappid: Fr,
                v: xr,
                platform: Hr,
                a2: null !== e.context ? e.context.a2Key : "",
                tinyid: null !== e.context ? e.context.tinyID : "",
                sdkappid: null !== e.loginInfo ? e.loginInfo.SDKAppID : 0,
                contentType: null !== e.context ? e.context.contentType : 0,
                apn: null !== e.context ? e.context.apn : "",
                reqtime: +new Date / 1e3
              },
              requestData: {}
            },
            update: null,
            delete: null
          }
        }(this.tim), this.config.longPollLogout = function (e) {
          return {
            create: null,
            query: {
              serverName: Vr.NAME.OPEN_IM,
              cmd: Vr.CMD.LOGOUT_LONG_POLL,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              method: "POST",
              queryString: {
                websdkappid: Fr,
                v: xr,
                platform: Hr,
                a2: null !== e.context ? e.context.a2Key : "",
                tinyid: null !== e.context ? e.context.tinyID : 0,
                sdkappid: null !== e.context ? e.context.SDKAppID : 0,
                contentType: null !== e.context ? e.context.contentType : 0,
                apn: null !== e.context ? e.context.apn : 1,
                reqtime: function () {
                  return Date.now()
                }
              },
              requestData: {longPollID: ""},
              keyMaps: {request: {longPollID: "LongPollingId"}}
            },
            update: null,
            delete: null
          }
        }(this.tim), this.config.profile = function (e) {
          var t = Nu(e), n = Vr.NAME.PROFILE, r = Vr.CHANNEL.XHR, o = Kr;
          return {
            query: {
              serverName: n,
              cmd: Vr.CMD.PORTRAIT_GET,
              channel: r,
              protocol: o,
              method: "POST",
              queryString: t,
              requestData: {fromAccount: "", userItem: []},
              keyMaps: {
                request: {
                  toAccount: "To_Account",
                  standardSequence: "StandardSequence",
                  customSequence: "CustomSequence"
                }
              }
            },
            update: {
              serverName: n,
              cmd: Vr.CMD.PORTRAIT_SET,
              channel: r,
              protocol: o,
              method: "POST",
              queryString: t,
              requestData: {
                fromAccount: "",
                profileItem: [{tag: Qe.NICK, value: ""}, {tag: Qe.GENDER, value: ""}, {
                  tag: Qe.ALLOWTYPE,
                  value: ""
                }, {tag: Qe.AVATAR, value: ""}]
              }
            }
          }
        }(this.tim), this.config.group = function (e) {
          var n = {
            websdkappid: Fr,
            v: xr,
            platform: Hr,
            a2: null !== e.context && e.context.a2Key ? e.context.a2Key : void 0,
            tinyid: null !== e.context && e.context.tinyID ? e.context.tinyID : void 0,
            sdkappid: null !== e.context ? e.context.SDKAppID : 0,
            contentType: null !== e.context ? e.context.contentType : 0,
            accounttype: null !== e.context ? e.context.accountType : 0
          }, r = {
            request: {
              ownerID: "Owner_Account",
              userID: "Member_Account",
              newOwnerID: "NewOwner_Account",
              maxMemberNum: "MaxMemberCount",
              groupCustomField: "AppDefinedData",
              memberCustomField: "AppMemberDefinedData",
              groupCustomFieldFilter: "AppDefinedDataFilter_Group",
              memberCustomFieldFilter: "AppDefinedDataFilter_GroupMember",
              messageRemindType: "MsgFlag",
              userIDList: "MemberList",
              groupIDList: "GroupIdList",
              applyMessage: "ApplyMsg",
              muteTime: "ShutUpTime",
              joinOption: "ApplyJoinOption"
            },
            response: {
              GroupIdList: "groups",
              MsgFlag: "messageRemindType",
              AppDefinedData: "groupCustomField",
              AppMemberDefinedData: "memberCustomField",
              AppDefinedDataFilter_Group: "groupCustomFieldFilter",
              AppDefinedDataFilter_GroupMember: "memberCustomFieldFilter",
              InfoSeq: "infoSequence",
              MemberList: "members",
              GroupInfo: "groups",
              ShutUpUntil: "muteUntil",
              ApplyJoinOption: "joinOption"
            }
          };
          return {
            create: {
              serverName: Vr.NAME.GROUP,
              cmd: Vr.CMD.CREATE_GROUP,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              queryString: n,
              requestData: {
                type: t.GRP_PRIVATE,
                name: void 0,
                groupID: void 0,
                ownerID: e.loginInfo.identifier,
                introduction: void 0,
                notification: void 0,
                avatar: void 0,
                maxMemberNum: void 0,
                joinOption: void 0,
                memberList: void 0,
                groupCustomField: void 0
              },
              keyMaps: r
            },
            list: {
              serverName: Vr.NAME.GROUP,
              cmd: Vr.CMD.GET_JOINED_GROUPS,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              queryString: n,
              requestData: {
                userID: e.loginInfo.identifier,
                limit: void 0,
                offset: void 0,
                groupType: void 0,
                responseFilter: void 0
              },
              keyMaps: r
            },
            query: {
              serverName: Vr.NAME.GROUP,
              cmd: Vr.CMD.GET_GROUP_INFO,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              queryString: n,
              requestData: {groupIDList: void 0, responseFilter: void 0},
              keyMaps: r
            },
            getGroupMemberProfile: {
              serverName: Vr.NAME.GROUP,
              cmd: Vr.CMD.GET_GROUP_MEMBER_INFO,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              queryString: n,
              requestData: {
                groupID: void 0,
                userIDList: void 0,
                memberInfoFilter: void 0,
                memberCustomFieldFilter: void 0
              },
              keyMaps: {request: u({}, r.request, {userIDList: "Member_List_Account"}), response: r.response}
            },
            getGroupMemberList: {
              serverName: Vr.NAME.GROUP,
              cmd: Vr.CMD.GET_GROUP_MEMBER_LIST,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              queryString: n,
              requestData: {groupID: void 0, limit: 0, offset: 0, memberRoleFilter: void 0, memberInfoFilter: void 0},
              keyMaps: r
            },
            quitGroup: {
              serverName: Vr.NAME.GROUP,
              cmd: Vr.CMD.QUIT_GROUP,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              queryString: n,
              requestData: {groupID: void 0}
            },
            changeGroupOwner: {
              serverName: Vr.NAME.GROUP,
              cmd: Vr.CMD.CHANGE_GROUP_OWNER,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              queryString: n,
              requestData: {groupID: void 0, newOwnerID: void 0},
              keyMaps: r
            },
            destroyGroup: {
              serverName: Vr.NAME.GROUP,
              cmd: Vr.CMD.DESTROY_GROUP,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              queryString: n,
              requestData: {groupID: void 0}
            },
            updateGroupProfile: {
              serverName: Vr.NAME.GROUP,
              cmd: Vr.CMD.MODIFY_GROUP_INFO,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              queryString: n,
              requestData: {
                groupID: void 0,
                name: void 0,
                introduction: void 0,
                notification: void 0,
                avatar: void 0,
                maxMemberNum: void 0,
                joinOption: void 0,
                groupCustomField: void 0
              },
              keyMaps: {request: u({}, r.request, {groupCustomField: "AppDefinedData"}), response: r.response}
            },
            modifyGroupMemberInfo: {
              serverName: Vr.NAME.GROUP,
              cmd: Vr.CMD.MODIFY_GROUP_MEMBER_INFO,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              queryString: n,
              requestData: {
                groupID: void 0,
                userID: void 0,
                messageRemindType: void 0,
                nameCard: void 0,
                role: void 0,
                memberCustomField: void 0,
                muteTime: void 0
              },
              keyMaps: r
            },
            addGroupMember: {
              serverName: Vr.NAME.GROUP,
              cmd: Vr.CMD.ADD_GROUP_MEMBER,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              queryString: n,
              requestData: {groupID: void 0, silence: void 0, userIDList: void 0},
              keyMaps: r
            },
            deleteGroupMember: {
              serverName: Vr.NAME.GROUP,
              cmd: Vr.CMD.DELETE_GROUP_MEMBER,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              queryString: n,
              requestData: {groupID: void 0, userIDList: void 0, reason: void 0},
              keyMaps: {request: {userIDList: "MemberToDel_Account"}}
            },
            searchGroupByID: {
              serverName: Vr.NAME.GROUP,
              cmd: Vr.CMD.SEARCH_GROUP_BY_ID,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              queryString: n,
              requestData: {
                groupIDList: void 0,
                responseFilter: {groupBasePublicInfoFilter: ["Type", "Name", "Introduction", "Notification", "FaceUrl", "CreateTime", "Owner_Account", "LastInfoTime", "LastMsgTime", "NextMsgSeq", "MemberNum", "MaxMemberNum", "ApplyJoinOption"]}
              },
              keyMaps: {request: {groupIDList: "GroupIdList"}}
            },
            applyJoinGroup: {
              serverName: Vr.NAME.GROUP,
              cmd: Vr.CMD.APPLY_JOIN_GROUP,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              queryString: n,
              requestData: {groupID: void 0, applyMessage: void 0, userDefinedField: void 0},
              keyMaps: r
            },
            applyJoinAVChatRoom: {
              serverName: Vr.NAME.BIG_GROUP_NO_AUTH,
              cmd: Vr.CMD.APPLY_JOIN_GROUP,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              queryString: {
                websdkappid: Fr,
                v: xr,
                platform: Hr,
                sdkappid: null !== e.context ? e.context.SDKAppID : 0,
                contentType: null !== e.context ? e.context.contentType : 0,
                accounttype: null !== e.context ? e.context.accountType : 0
              },
              requestData: {groupID: void 0, applyMessage: void 0, userDefinedField: void 0},
              keyMaps: r
            },
            handleApplyJoinGroup: {
              serverName: Vr.NAME.GROUP,
              cmd: Vr.CMD.HANDLE_APPLY_JOIN_GROUP,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              queryString: n,
              requestData: {
                groupID: void 0,
                applicant: void 0,
                handleAction: void 0,
                handleMessage: void 0,
                authentication: void 0,
                messageKey: void 0,
                userDefinedField: void 0
              },
              keyMaps: {
                request: {
                  applicant: "Applicant_Account",
                  handleAction: "HandleMsg",
                  handleMessage: "ApprovalMsg",
                  messageKey: "MsgKey"
                }, response: {MsgKey: "messageKey"}
              }
            },
            deleteGroupSystemNotice: {
              serverName: Vr.NAME.OPEN_IM,
              cmd: Vr.CMD.DELETE_GROUP_SYSTEM_MESSAGE,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              queryString: n,
              requestData: {messageListToDelete: void 0},
              keyMaps: {request: {messageListToDelete: "DelMsgList", messageSeq: "MsgSeq", messageRandom: "MsgRandom"}}
            },
            getGroupPendency: {
              serverName: Vr.NAME.GROUP,
              cmd: Vr.CMD.GET_GROUP_PENDENCY,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              queryString: n,
              requestData: {startTime: void 0, limit: void 0, handleAccount: void 0},
              keyMaps: {request: {handleAccount: "Handle_Account"}}
            }
          }
        }(this.tim), this.config.longPollID = function (e) {
          return {
            create: {},
            query: {
              serverName: Vr.NAME.OPEN_IM,
              cmd: Vr.CMD.GET_LONG_POLL_ID,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              queryString: {
                websdkappid: Fr,
                v: xr,
                platform: Hr,
                a2: null !== e.context ? e.context.a2Key : "",
                tinyid: null !== e.context ? e.context.tinyID : 0,
                sdkappid: null !== e.context ? e.context.SDKAppID : 0,
                contentType: null !== e.context ? e.context.contentType : 0,
                apn: null !== e.context ? e.context.apn : 1,
                reqtime: +new Date / 1e3
              },
              requestData: {},
              keyMaps: {response: {LongPollingId: "longPollingID"}}
            },
            update: {},
            delete: {}
          }
        }(this.tim), this.config.longPoll = function (e) {
          var t = {
            websdkappid: Fr,
            v: xr,
            platform: Hr,
            a2: null !== e.context ? e.context.a2Key : "",
            tinyid: null !== e.context ? e.context.tinyID : 0,
            sdkappid: null !== e.context ? e.context.SDKAppID : 0,
            contentType: null !== e.context ? e.context.contentType : 0,
            accounttype: null !== e.context ? e.loginInfo.accountType : 0,
            apn: null !== e.context ? e.context.apn : 1,
            reqtime: Math.ceil(+new Date / 1e3)
          };
          return {
            create: {},
            query: {
              serverName: Vr.NAME.OPEN_IM,
              cmd: Vr.CMD.LONG_POLL,
              channel: Vr.CHANNEL.AUTO,
              protocol: Kr,
              queryString: t,
              requestData: {timeout: null, cookie: {notifySeq: 0, noticeSeq: 0, longPollingID: 0}},
              keyMaps: {
                response: {
                  C2cMsgArray: "C2CMessageArray",
                  GroupMsgArray: "groupMessageArray",
                  GroupTips: "groupTips",
                  C2cNotifyMsgArray: "C2CNotifyMessageArray",
                  ClientSeq: "clientSequence",
                  MsgPriority: "priority",
                  NoticeSeq: "noticeSequence",
                  MsgContent: "content",
                  MsgType: "type",
                  MsgBody: "elements",
                  ToGroupId: "to",
                  Desc: "description",
                  Ext: "extension"
                }
              }
            },
            update: {},
            delete: {}
          }
        }(this.tim), this.config.applyC2C = function (e) {
          var t = Nu(e), n = Vr.NAME.FRIEND, r = Vr.CHANNEL.XHR, o = Kr;
          return {
            create: {
              serverName: n,
              cmd: Vr.CMD.FRIEND_ADD,
              channel: r,
              protocol: o,
              queryString: t,
              requestData: {fromAccount: "", addFriendItem: []}
            },
            get: {
              serverName: n,
              cmd: Vr.CMD.GET_PENDENCY,
              channel: r,
              protocol: o,
              queryString: t,
              requestData: {fromAccount: "", pendencyType: "Pendency_Type_ComeIn"}
            },
            update: {
              serverName: n,
              cmd: Vr.CMD.RESPONSE_PENDENCY,
              channel: r,
              protocol: o,
              queryString: t,
              requestData: {fromAccount: "", responseFriendItem: []}
            },
            delete: {
              serverName: n,
              cmd: Vr.CMD.DELETE_PENDENCY,
              channel: r,
              protocol: o,
              queryString: t,
              requestData: {fromAccount: "", toAccount: [], pendencyType: "Pendency_Type_ComeIn"}
            }
          }
        }(this.tim), this.config.friend = function (e) {
          var t = Nu(e), n = Vr.NAME.FRIEND, r = Vr.CHANNEL.XHR, o = Kr;
          return {
            get: {
              serverName: n,
              cmd: Vr.CMD.FRIEND_GET_ALL,
              channel: r,
              protocol: o,
              method: "POST",
              queryString: t,
              requestData: {
                fromAccount: "",
                timeStamp: 0,
                startIndex: 0,
                getCount: 100,
                lastStandardSequence: 0,
                tagList: ["Tag_Profile_IM_Nick", "Tag_SNS_IM_Remark"]
              },
              keyMaps: {request: {}, response: {}}
            },
            delete: {
              serverName: n,
              cmd: Vr.CMD.FRIEND_DELETE,
              channel: r,
              protocol: o,
              method: "POST",
              queryString: t,
              requestData: {fromAccount: "", toAccount: [], deleteType: "Delete_Type_Single"}
            }
          }
        }(this.tim), this.config.blacklist = function (e) {
          var t = Nu(e);
          return {
            create: {
              serverName: Vr.NAME.FRIEND,
              cmd: Vr.CMD.ADD_BLACKLIST,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              method: "POST",
              queryString: t,
              requestData: {fromAccount: "", toAccount: []}
            },
            get: {
              serverName: Vr.NAME.FRIEND,
              cmd: Vr.CMD.GET_BLACKLIST,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              method: "POST",
              queryString: t,
              requestData: {fromAccount: "", startIndex: 0, maxLimited: 30, lastSequence: 0}
            },
            delete: {
              serverName: Vr.NAME.FRIEND,
              cmd: Vr.CMD.DELETE_BLACKLIST,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              method: "POST",
              queryString: t,
              requestData: {fromAccount: "", toAccount: []}
            },
            update: {}
          }
        }(this.tim), this.config.c2cMessage = function (e) {
          var t = {
            platform: Hr,
            websdkappid: Fr,
            v: xr,
            a2: null !== e.context ? e.context.a2Key : "",
            tinyid: null !== e.context ? e.context.tinyID : 0,
            sdkappid: null !== e.context ? e.context.SDKAppID : 0,
            contentType: null !== e.context ? e.context.contentType : 0,
            apn: null !== e.context ? e.context.apn : 1,
            reqtime: function () {
              return +new Date
            }
          }, n = {
            request: {
              fromAccount: "From_Account",
              toAccount: "To_Account",
              msgTimeStamp: "MsgTimeStamp",
              msgSeq: "MsgSeq",
              msgRandom: "MsgRandom",
              msgBody: "MsgBody",
              count: "MaxCnt",
              lastMessageTime: "LastMsgTime",
              messageKey: "MsgKey",
              peerAccount: "Peer_Account",
              data: "Data",
              description: "Desc",
              extension: "Ext",
              type: "MsgType",
              content: "MsgContent",
              sizeType: "Type",
              uuid: "UUID",
              imageUrl: "URL",
              fileUrl: "Url",
              remoteAudioUrl: "Url",
              remoteVideoUrl: "VideoUrl",
              thumbUUID: "ThumbUUID",
              videoUUID: "VideoUUID",
              videoUrl: "",
              downloadFlag: "Download_Flag"
            },
            response: {
              MsgContent: "content",
              MsgTime: "time",
              Data: "data",
              Desc: "description",
              Ext: "extension",
              MsgKey: "messageKey",
              MsgType: "type",
              MsgBody: "elements",
              Download_Flag: "downloadFlag"
            }
          };
          return {
            create: {
              serverName: Vr.NAME.OPEN_IM,
              cmd: Vr.CMD.SEND_MESSAGE,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              method: "POST",
              queryString: t,
              requestData: {
                fromAccount: e.loginInfo.identifier,
                toAccount: "",
                msgTimeStamp: Math.ceil(+new Date / 1e3),
                msgSeq: 0,
                msgRandom: 0,
                msgBody: []
              },
              keyMaps: n
            },
            query: {
              serverName: Vr.NAME.OPEN_IM,
              cmd: Vr.CMD.GET_C2C_ROAM_MESSAGES,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              method: "POST",
              queryString: t,
              requestData: {peerAccount: "", count: 15, lastMessageTime: 0, messageKey: "", withRecalledMsg: 1},
              keyMaps: n
            },
            update: null,
            delete: null
          }
        }(this.tim), this.config.c2cMessageWillBeRevoked = function (e) {
          var t = {
            platform: Hr,
            websdkappid: Fr,
            v: xr,
            a2: null !== e.context ? e.context.a2Key : "",
            tinyid: null !== e.context ? e.context.tinyID : 0,
            sdkappid: null !== e.context ? e.context.SDKAppID : 0,
            contentType: null !== e.context ? e.context.contentType : 0,
            apn: null !== e.context ? e.context.apn : 1,
            reqtime: function () {
              return +new Date
            }
          };
          return {
            create: {
              serverName: Vr.NAME.OPEN_IM,
              cmd: Vr.CMD.REVOKE_C2C_MESSAGE,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              method: "POST",
              queryString: t,
              requestData: {
                msgInfo: {
                  fromAccount: "",
                  toAccount: "",
                  msgTimeStamp: Math.ceil(+new Date / 1e3),
                  msgSeq: 0,
                  msgRandom: 0
                }
              },
              keyMaps: {
                request: {
                  msgInfo: "MsgInfo",
                  fromAccount: "From_Account",
                  toAccount: "To_Account",
                  msgTimeStamp: "MsgTimeStamp",
                  msgSeq: "MsgSeq",
                  msgRandom: "MsgRandom",
                  msgBody: "MsgBody"
                }
              }
            }
          }
        }(this.tim), this.config.groupMessage = function (e) {
          var t = {
            platform: Hr,
            websdkappid: Fr,
            v: xr,
            a2: null !== e.context ? e.context.a2Key : "",
            tinyid: null !== e.context ? e.context.tinyID : 0,
            sdkappid: null !== e.context ? e.context.SDKAppID : 0,
            contentType: null !== e.context ? e.context.contentType : 0,
            apn: null !== e.context ? e.context.apn : 1,
            reqtime: function () {
              return +new Date
            }
          }, n = {
            request: {
              to: "GroupId",
              extension: "Ext",
              data: "Data",
              description: "Desc",
              random: "Random",
              sequence: "ReqMsgSeq",
              count: "ReqMsgNumber",
              type: "MsgType",
              priority: "MsgPriority",
              content: "MsgContent",
              elements: "MsgBody",
              sizeType: "Type",
              uuid: "UUID",
              imageUrl: "URL",
              fileUrl: "Url",
              remoteAudioUrl: "Url",
              remoteVideoUrl: "VideoUrl",
              thumbUUID: "ThumbUUID",
              videoUUID: "VideoUUID",
              videoUrl: "",
              downloadFlag: "Download_Flag",
              clientSequence: "ClientSeq"
            },
            response: {
              Random: "random",
              MsgTime: "time",
              MsgSeq: "sequence",
              ReqMsgSeq: "sequence",
              RspMsgList: "messageList",
              IsPlaceMsg: "isPlaceMessage",
              IsSystemMsg: "isSystemMessage",
              ToGroupId: "to",
              EnumFrom_AccountType: "fromAccountType",
              EnumTo_AccountType: "toAccountType",
              GroupCode: "groupCode",
              MsgPriority: "priority",
              MsgBody: "elements",
              MsgType: "type",
              MsgContent: "content",
              IsFinished: "complete",
              Download_Flag: "downloadFlag",
              ClientSeq: "clientSequence"
            }
          };
          return {
            create: {
              serverName: Vr.NAME.GROUP,
              cmd: Vr.CMD.SEND_GROUP_MESSAGE,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              method: "POST",
              queryString: t,
              requestData: {
                groupID: "",
                fromAccount: e.loginInfo.identifier,
                random: 0,
                clientSequence: 0,
                priority: "",
                msgBody: []
              },
              keyMaps: n
            },
            query: {
              serverName: Vr.NAME.GROUP,
              cmd: Vr.CMD.GET_GROUP_ROAM_MESSAGES,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              method: "POST",
              queryString: t,
              requestData: {withRecalledMsg: 1, groupID: "", count: 15, sequence: ""},
              keyMaps: n
            },
            update: null,
            delete: null
          }
        }(this.tim), this.config.groupMessageWillBeRevoked = function (e) {
          var t = {
            platform: Hr,
            websdkappid: Fr,
            v: xr,
            a2: null !== e.context ? e.context.a2Key : "",
            tinyid: null !== e.context ? e.context.tinyID : 0,
            sdkappid: null !== e.context ? e.context.SDKAppID : 0,
            contentType: null !== e.context ? e.context.contentType : 0,
            apn: null !== e.context ? e.context.apn : 1,
            reqtime: function () {
              return +new Date
            }
          };
          return {
            create: {
              serverName: Vr.NAME.GROUP,
              cmd: Vr.CMD.REVOKE_GROUP_MESSAGE,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              method: "POST",
              queryString: t,
              requestData: {to: "", msgSeqList: []},
              keyMaps: {request: {to: "GroupId", msgSeqList: "MsgSeqList", msgSeq: "MsgSeq"}}
            }
          }
        }(this.tim), this.config.conversation = function (e) {
          var t = {
            platform: Hr,
            websdkappid: Fr,
            v: xr,
            a2: null !== e.context ? e.context.a2Key : "",
            tinyid: null !== e.context ? e.context.tinyID : 0,
            sdkappid: null !== e.context ? e.context.SDKAppID : 0,
            contentType: null !== e.context ? e.context.contentType : 0,
            apn: null !== e.context ? e.context.apn : 1
          };
          return {
            query: {
              serverName: Vr.NAME.RECENT_CONTACT,
              cmd: Vr.CMD.GET_CONVERSATION_LIST,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              method: "POST",
              queryString: t,
              requestData: {fromAccount: e.loginInfo.identifier, count: 0},
              keyMaps: {
                request: {},
                response: {
                  SessionItem: "conversations",
                  ToAccount: "groupID",
                  To_Account: "userID",
                  UnreadMsgCount: "unreadCount",
                  MsgGroupReadedSeq: "messageReadSeq"
                }
              }
            },
            pagingQuery: {
              serverName: Vr.NAME.RECENT_CONTACT,
              cmd: Vr.CMD.PAGING_GET_CONVERSATION_LIST,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              method: "POST",
              queryString: t,
              requestData: {fromAccount: void 0, timeStamp: void 0, orderType: void 0},
              keyMaps: {
                request: {},
                response: {
                  SessionItem: "conversations",
                  ToAccount: "groupID",
                  To_Account: "userID",
                  UnreadMsgCount: "unreadCount",
                  MsgGroupReadedSeq: "messageReadSeq"
                }
              }
            },
            delete: {
              serverName: Vr.NAME.RECENT_CONTACT,
              cmd: Vr.CMD.DELETE_CONVERSATION,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              method: "POST",
              queryString: t,
              requestData: {fromAccount: e.loginInfo.identifier, toAccount: void 0, type: 1, toGroupID: void 0},
              keyMaps: {request: {toGroupID: "ToGroupid"}}
            },
            setC2CMessageRead: {
              serverName: Vr.NAME.OPEN_IM,
              cmd: Vr.CMD.SET_C2C_MESSAGE_READ,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              method: "POST",
              queryString: t,
              requestData: {C2CMsgReaded: void 0},
              keyMaps: {request: {lastMessageTime: "LastedMsgTime"}}
            },
            setGroupMessageRead: {
              serverName: Vr.NAME.GROUP,
              cmd: Vr.CMD.SET_GROUP_MESSAGE_READ,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              method: "POST",
              queryString: t,
              requestData: {groupID: void 0, messageReadSeq: void 0},
              keyMaps: {request: {messageReadSeq: "MsgReadedSeq"}}
            }
          }
        }(this.tim), this.config.syncMessage = function (e) {
          var t = {
            platform: Hr,
            websdkappid: Fr,
            v: xr,
            a2: null !== e.context ? e.context.a2Key : "",
            tinyid: null !== e.context ? e.context.tinyID : 0,
            sdkappid: null !== e.context ? e.context.SDKAppID : 0,
            contentType: null !== e.context ? e.context.contentType : 0,
            apn: null !== e.context ? e.context.apn : 1,
            reqtime: function () {
              return [Math.ceil(+new Date), Math.random()].join("")
            }
          };
          return {
            create: null,
            query: {
              serverName: Vr.NAME.OPEN_IM,
              cmd: Vr.CMD.GET_MESSAGES,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              method: "POST",
              queryString: t,
              requestData: {cookie: "", syncFlag: 0, needAbstract: 1},
              keyMaps: {
                request: {
                  fromAccount: "From_Account",
                  toAccount: "To_Account",
                  from: "From_Account",
                  to: "To_Account",
                  time: "MsgTimeStamp",
                  sequence: "MsgSeq",
                  random: "MsgRandom",
                  elements: "MsgBody"
                },
                response: {
                  MsgList: "messageList",
                  SyncFlag: "syncFlag",
                  To_Account: "to",
                  From_Account: "from",
                  ClientSeq: "clientSequence",
                  MsgSeq: "sequence",
                  NoticeSeq: "noticeSequence",
                  NotifySeq: "notifySequence",
                  MsgRandom: "random",
                  MsgTimeStamp: "time",
                  MsgContent: "content",
                  ToGroupId: "groupID",
                  MsgKey: "messageKey",
                  GroupTips: "groupTips",
                  MsgBody: "elements",
                  MsgType: "type",
                  C2CRemainingUnreadCount: "C2CRemainingUnreadList"
                }
              }
            },
            update: null,
            delete: null
          }
        }(this.tim), this.config.AVChatRoom = function (e) {
          return {
            startLongPoll: {
              serverName: Vr.NAME.BIG_GROUP_LONG_POLLING_NO_AUTH,
              cmd: Vr.CMD.AVCHATROOM_LONG_POLL,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              method: "POST",
              queryString: {
                websdkappid: Fr,
                v: xr,
                platform: Hr,
                sdkappid: e.loginInfo.SDKAppID,
                accounttype: "792",
                apn: null !== e.context ? e.context.apn : 1,
                reqtime: function () {
                  return +new Date
                }
              },
              requestData: {USP: 1, startSeq: 1, holdTime: 90, key: void 0},
              keyMaps: {request: {USP: "USP"}, response: {ToGroupId: "groupID"}}
            }
          }
        }(this.tim), this.config.cosUpload = function (e) {
          var t = {
            platform: Hr,
            websdkappid: Fr,
            v: xr,
            a2: null !== e.context ? e.context.a2Key : "",
            tinyid: null !== e.context ? e.context.tinyID : 0,
            sdkappid: null !== e.context ? e.context.SDKAppID : 0,
            contentType: null !== e.context ? e.context.contentType : 0,
            apn: null !== e.context ? e.context.apn : 1,
            reqtime: function () {
              return Date.now()
            }
          };
          return {
            create: {
              serverName: Vr.NAME.OPEN_IM,
              cmd: Vr.CMD.FILE_UPLOAD,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              method: "POST",
              queryString: t,
              requestData: {
                appVersion: "2.1",
                fromAccount: "",
                toAccount: "",
                sequence: 0,
                time: function () {
                  return Math.ceil(Date.now() / 1e3)
                },
                random: function () {
                  return fe()
                },
                fileStrMd5: "",
                fileSize: "",
                serverVer: 1,
                authKey: "",
                busiId: 1,
                pkgFlag: 1,
                sliceOffset: 0,
                sliceSize: 0,
                sliceData: "",
                contentType: "application/x-www-form-urlencoded"
              },
              keyMaps: {request: {}, response: {}}
            }, update: null, delete: null
          }
        }(this.tim), this.config.cosSig = function (e) {
          var t = {
            sdkappid: function () {
              return e.loginInfo.SDKAppID
            }, identifier: function () {
              return e.loginInfo.identifier
            }, userSig: function () {
              return e.context.userSig
            }
          };
          return {
            create: null,
            query: {
              serverName: Vr.NAME.IM_COS_SIGN,
              cmd: Vr.CMD.COS_SIGN,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              method: "POST",
              queryString: t,
              requestData: {cmd: "open_im_cos_svc", subCmd: "get_cos_token", duration: 300, version: 2},
              keyMaps: {
                request: {
                  userSig: "usersig",
                  subCmd: "sub_cmd",
                  cmd: "cmd",
                  duration: "duration",
                  version: "version"
                },
                response: {
                  expired_time: "expiredTime",
                  bucket_name: "bucketName",
                  session_token: "sessionToken",
                  tmp_secret_id: "secretId",
                  tmp_secret_key: "secretKey"
                }
              }
            },
            update: null,
            delete: null
          }
        }(this.tim), this.config.bigDataHallwayAuthKey = function (e) {
          return {
            create: null,
            query: {
              serverName: Vr.NAME.OPEN_IM,
              cmd: Vr.CMD.BIG_DATA_HALLWAY_AUTH_KEY,
              channel: Vr.CHANNEL.XHR,
              protocol: Kr,
              method: "POST",
              queryString: {
                websdkappid: Fr,
                v: xr,
                platform: Hr,
                sdkappid: e.loginInfo.SDKAppID,
                accounttype: "792",
                apn: null !== e.context ? e.context.apn : 1,
                reqtime: function () {
                  return +new Date
                }
              },
              requestData: {}
            }
          }
        }(this.tim), this.config.ssoEventStat = function (e) {
          var t = null;
          null !== e.context && (t = {sdkappid: e.context.SDKAppID, reqtime: Math.ceil(+new Date / 1e3)});
          return {
            create: {
              serverName: Vr.NAME.IM_OPEN_STAT,
              cmd: Vr.CMD.TIM_WEB_REPORT,
              channel: Vr.CHANNEL.AUTO,
              protocol: Kr,
              queryString: t,
              requestData: {table: "", report: []},
              keyMaps: {
                request: {
                  table: "table",
                  report: "report",
                  SDKAppID: "sdkappid",
                  version: "version",
                  tinyID: "tinyid",
                  userID: "userid",
                  platform: "platform",
                  method: "method",
                  time: "time",
                  start: "start",
                  end: "end",
                  cost: "cost",
                  status: "status",
                  codeint: "codeint",
                  message: "message",
                  pointer: "pointer",
                  text: "text",
                  msgType: "msgtype",
                  networkType: "networktype",
                  startts: "startts",
                  endts: "endts",
                  timespan: "timespan"
                }
              }
            }, query: {}, update: {}, delete: {}
          }
        }(this.tim), this.config.ssoSumStat = function (e) {
          var t = null;
          null !== e.context && (t = {sdkappid: e.context.SDKAppID, reqtime: Math.ceil(+new Date / 1e3)});
          return {
            create: {
              serverName: Vr.NAME.IM_OPEN_STAT,
              cmd: Vr.CMD.TIM_WEB_REPORT,
              channel: Vr.CHANNEL.AUTO,
              protocol: Kr,
              queryString: t,
              requestData: {table: "", report: []},
              keyMaps: {
                request: {
                  table: "table",
                  report: "report",
                  SDKAppID: "sdkappid",
                  version: "version",
                  tinyID: "tinyid",
                  userID: "userid",
                  item: "item",
                  lpID: "lpid",
                  platform: "platform",
                  networkType: "networktype",
                  total: "total",
                  successRate: "successrate",
                  avg: "avg",
                  timespan: "timespan",
                  time: "time"
                }
              }
            }, query: {}, update: {}, delete: {}
          }
        }(this.tim)
      }
    }, {
      key: "_initRequestData", value: function (e, t) {
        if (void 0 === e) return Bo(t.requestData, this._getRequestMap(t), this.tim);
        var n = t.requestData, r = Object.create(null);
        for (var o in n) if (Object.prototype.hasOwnProperty.call(n, o)) {
          if (r[o] = "function" == typeof n[o] ? n[o]() : n[o], void 0 === e[o]) continue;
          r[o] = e[o]
        }
        return r = Bo(r, this._getRequestMap(t), this.tim)
      }
    }, {
      key: "_getRequestMap", value: function (e) {
        if (e.keyMaps && e.keyMaps.request && Object.keys(e.keyMaps.request).length > 0) return e.keyMaps.request
      }
    }, {
      key: "_initEncoder", value: function (e) {
        switch (e.protocol) {
          case Kr:
            return function (e) {
              if ("string" === n(e)) try {
                return JSON.parse(e)
              } catch (t) {
                return e
              }
              return e
            };
          case Br:
            return function (e) {
              return e
            };
          default:
            return function (e) {
              return z.warn("PackageConfig._initEncoder(), unknow response type, data: ", JSON.stringify(e)), e
            }
        }
      }
    }, {
      key: "_initDecoder", value: function (e) {
        switch (e.protocol) {
          case Kr:
            return function (e) {
              if ("string" === n(e)) try {
                return JSON.parse(e)
              } catch (t) {
                return e
              }
              return e
            };
          case Br:
            return function (e) {
              return e
            };
          default:
            return function (e) {
              return z.warn("PackageConfig._initDecoder(), unknow response type, data: ", e), e
            }
        }
      }
    }]), e
  }(), Uu = {
    C2CMessageArray: 1,
    groupMessageArray: 1,
    groupTips: 1,
    C2CNotifyMessageArray: 1,
    profileModify: 1,
    friendListMod: 1
  }, qu = function (e) {
    function t(e) {
      var n;
      return r(this, t), (n = m(this, l(t).call(this, e)))._initialization(), n
    }

    return c(t, e), i(t, [{
      key: "_initialization", value: function () {
        this._syncOffset = "", this._syncNoticeList = [], this._syncEventArray = [], this._syncMessagesIsRunning = !1, this._syncMessagesFinished = !1, this._isLongPoll = !1, this._longPollID = 0, this._noticeSequence = 0, this._initializeListener(), this._runLoop = null, this._initShuntChannels()
      }
    }, {
      key: "_initShuntChannels", value: function () {
        this._shuntChannels = Object.create(null), this._shuntChannels.C2CMessageArray = this._C2CMessageArrayChannel.bind(this), this._shuntChannels.groupMessageArray = this._groupMessageArrayChannel.bind(this), this._shuntChannels.groupTips = this._groupTipsChannel.bind(this), this._shuntChannels.C2CNotifyMessageArray = this._C2CNotifyMessageArrayChannel.bind(this), this._shuntChannels.profileModify = this._profileModifyChannel.bind(this), this._shuntChannels.friendListMod = this._friendListModChannel.bind(this)
      }
    }, {
      key: "_C2CMessageArrayChannel", value: function (e, t, n) {
        this.tim.innerEmitter.emit(yo, {data: t, type: n})
      }
    }, {
      key: "_groupMessageArrayChannel", value: function (e, t, n) {
        this.tim.innerEmitter.emit(vo, {data: t})
      }
    }, {
      key: "_groupTipsChannel", value: function (e, t, n) {
        var r = this;
        switch (e) {
          case 4:
            this.tim.innerEmitter.emit(_o, {data: t});
            break;
          case 5:
            t.forEach((function (e) {
              ee(e.elements.revokedInfos) ? r.tim.innerEmitter.emit(ko, {data: t}) : r.tim.innerEmitter.emit(Mo, {
                data: {
                  groupSystemNotices: t,
                  type: n
                }
              })
            }));
            break;
          default:
            z.warn("未知的群事件类型 Event:".concat(e))
        }
      }
    }, {
      key: "_C2CNotifyMessageArrayChannel", value: function (e, t, n) {
        this._isKickedoutNotice(t) ? this.tim.innerEmitter.emit(mo) : this._isSysCmdMsgNotify(t) ? this.tim.innerEmitter.emit(So) : this._isC2CMessageRevokedNotify(t) && this.tim.innerEmitter.emit(To, {
          data: t,
          type: n
        })
      }
    }, {
      key: "_profileModifyChannel", value: function (e, t, n) {
        this.tim.innerEmitter.emit(Io, {data: t})
      }
    }, {
      key: "_friendListModChannel", value: function (e, t, n) {
        this.tim.innerEmitter.emit(Co, {data: t})
      }
    }, {
      key: "_dispatchNotice", value: function (e) {
        var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "poll";
        if (ee(e)) for (var n = this.tim.innerEmitter, r = null, o = null, i = "", s = "", a = "", u = 0, c = 0, l = e.length; c < l; c++) u = (r = e[c]).event, i = Object.keys(r).find((function (e) {
          return void 0 !== Uu[e]
        })), re(this._shuntChannels[i]) ? (o = r[i], "poll" === t && this._updatenoticeSequence(o), this._shuntChannels[i](u, o, t)) : ("poll" === t && this._updatenoticeSequence(), s = "".concat(dn), a = "".concat(kr, ": ").concat(u, ", ").concat(i), n.emit(bo, new lt({
          code: s,
          message: a,
          data: {payloadName: i, event: u}
        })), s = "", a = "")
      }
    }, {
      key: "getLongPollID", value: function () {
        return this._longPollID
      }
    }, {
      key: "_IAmReady", value: function () {
        this.triggerReady()
      }
    }, {
      key: "reset", value: function () {
        this._noticeSequence = 0, this._resetSync(), this.closeNoticeChannel()
      }
    }, {
      key: "_resetSync", value: function () {
        this._syncOffset = "", this._syncNoticeList = [], this._syncEventArray = [], this._syncMessagesIsRunning = !1, this._syncMessagesFinished = !1
      }
    }, {
      key: "_setNoticeSeqInRequestData", value: function (e) {
        e.Cookie.NoticeSeq = this._noticeSequence, this.tim.sumStatController.addTotalCount(ni)
      }
    }, {
      key: "_updatenoticeSequence", value: function (e) {
        if (e) {
          var t = e[e.length - 1].noticeSequence;
          t && "number" == typeof t ? t <= this._noticeSequence || (this._noticeSequence = t) : this._noticeSequence++
        } else this._noticeSequence++
      }
    }, {
      key: "_initializeListener", value: function () {
        var e = this.tim.innerEmitter;
        e.on(Do, this.restartNoticeChannel, this), e.on(zr, this._startSyncMessages, this), e.on(Xr, this.openNoticeChannel, this), e.on(Lo, this.closeNoticeChannel, this), e.on(lo, this._onChannelReconnect, this), e.on(ho, this._onChannelDisconnected, this)
      }
    }, {
      key: "openNoticeChannel", value: function () {
        z.log("NotificationController.openNoticeChannel"), this._getLongPollID()
      }
    }, {
      key: "closeNoticeChannel", value: function () {
        z.log("NotificationController.closeNoticeChannel()"), (this._runLoop instanceof Qa || this._runLoop instanceof Za) && (this._runLoop.abort(), this._runLoop.stop()), this._longPollID = 0, this._isLongPoll = !1, this.tim.innerEmitter.emit(fo)
      }
    }, {
      key: "restartNoticeChannel", value: function () {
        this.closeNoticeChannel(), this._syncMessagesFinished = !1, this._startSyncMessages()
      }
    }, {
      key: "_getLongPollID", value: function () {
        var e = this, t = this.tim, n = t.innerEmitter, r = t.connectionController;
        if (0 === this._longPollID) {
          var o = this.createPackage({name: "longPollID", action: "query"});
          r.request(o).then((function (t) {
            t.data.errorCode === Re.SUCCESS ? e._onGetLongPollIDSuccess({data: t.data.longPollingID}) : e._onGetLongPollIDFail({data: t.data})
          })).catch((function (e) {
            n.emit(bo, new lt({code: vn, message: Er}))
          }))
        } else this._onGetLongPollIDSuccess({data: this._longPollID})
      }
    }, {
      key: "_onGetLongPollIDSuccess", value: function (e) {
        this.tim.packageConfig.set({
          key: "long_poll_logout.query.requestData.longPollingID",
          value: e.data
        }), this.tim.packageConfig.set({
          key: "longPoll.query.requestData.cookie.longPollingID",
          value: e.data
        }), this._longPollID = e.data, this._startLongPoll(), this._IAmReady(), this.tim.sumStatController.recordLongPollingID(this._longPollID)
      }
    }, {
      key: "_onGetLongPollIDFail", value: function (e) {
        z.warn("Notification._onGetLongPollIDFail", e)
      }
    }, {
      key: "_startLongPoll", value: function () {
        if (!0 !== this._isLongPoll) {
          z.log("NotificationController._startLongPoll...");
          var e = this.tim, t = e.connectionController, n = e.innerEmitter,
            r = this.createPackage({name: "longPoll", action: "query"});
          this._isLongPoll = !0, n.emit(so, {data: Date.now()}), this._runLoop = t.createRunLoop({
            pack: r,
            before: this._setNoticeSeqInRequestData.bind(this),
            success: this._onNoticeReceived.bind(this),
            fail: this._onNoticeFail.bind(this)
          }), this._runLoop.start()
        } else z.log("NotificationController._startLongPoll is running...")
      }
    }, {
      key: "_onChannelReconnect", value: function (e) {
        this.closeNoticeChannel(), this.syncMessage()
      }
    }, {
      key: "_onChannelDisconnected", value: function () {
      }
    }, {
      key: "_onNoticeReceived", value: function (e) {
        var t = this.tim, n = t.innerEmitter, r = t.statusController, o = e.data, i = !r.getChannelStatus();
        if (n.emit(ao, {data: Date.now()}), o.errorCode !== Re.SUCCESS) {
          var s = new ui;
          if (s.setMethod(Ni).setStart(), s.setMessage(o.errorInfo).setCode(o.errorCode).setNetworkType(this.getNetworkType()).setEnd(), o.errorCode === Mn) return n.emit(go), z.log("NotificationController._onNoticeReceived(), longPollingID was kicked"), void this.closeNoticeChannel();
          n.emit(co, new lt({code: o.errorCode, message: o.errorInfo}))
        }
        this.tim.sumStatController.addSuccessCount(ni), this.tim.sumStatController.addCost(ni, o.timecost), e.data.eventArray && !0 !== i && this._dispatchNotice(e.data.eventArray)
      }
    }, {
      key: "_onNoticeFail", value: function (e) {
        var t = new ui;
        t.setMethod(Ni).setStart(), this.probeNetwork((function (n, r) {
          t.setError(e.error, n, r).setEnd()
        })), this.tim.innerEmitter.emit(bo, e.error), this.tim.innerEmitter.emit(uo, {data: Date.now()})
      }
    }, {
      key: "_isKickedoutNotice", value: function (e) {
        return !!e[0].hasOwnProperty("kickoutMsgNotify")
      }
    }, {
      key: "_isSysCmdMsgNotify", value: function (e) {
        if (!e[0]) return !1;
        var t = e[0];
        return !!Object.prototype.hasOwnProperty.call(t, "sysCmdMsgNotify")
      }
    }, {
      key: "_isC2CMessageRevokedNotify", value: function (e) {
        var t = e[0];
        return !!Object.prototype.hasOwnProperty.call(t, "c2cMessageRevokedNotify")
      }
    }, {
      key: "_startSyncMessages", value: function (e) {
        !0 !== this._syncMessagesFinished && this.syncMessage()
      }
    }, {
      key: "syncMessage", value: function () {
        var e = this, t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "",
          n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, r = this.tim,
          o = r.connectionController, i = r.innerEmitter;
        this._syncMessagesIsRunning = !0;
        var s = this.createPackage({name: "syncMessage", action: "query", param: {cookie: t, syncFlag: n}});
        o.request(s).then((function (t) {
          var n = t.data;
          switch (Au(n.cookie, n.syncFlag)) {
            case"00":
            case"01":
              i.emit(bo, {code: mn, message: Tr});
              break;
            case"10":
            case"11":
              n.eventArray && e._dispatchNotice(n.eventArray, "sync"), e._syncNoticeList = e._syncNoticeList.concat(n.messageList), i.emit(Wr, {
                data: n.messageList,
                C2CRemainingUnreadList: n.C2CRemainingUnreadList
              }), e._syncOffset = n.cookie, e.syncMessage(n.cookie, n.syncFlag);
              break;
            case"12":
              n.eventArray && e._dispatchNotice(n.eventArray, "sync"), e._syncNoticeList = e._syncNoticeList.concat(n.messageList), i.emit(Xr, {
                data: n.messageList,
                C2CRemainingUnreadList: n.C2CRemainingUnreadList
              }), e._syncOffset = n.cookie, e._syncNoticeList = [], e._syncMessagesIsRunning = !1, e._syncMessagesFinished = !0
          }
        })).catch((function (t) {
          e._syncMessagesIsRunning = !1, z.error("NotificationController.syncMessage() failed, error:", JSON.stringify(t))
        }))
      }
    }]), t
  }($o), xu = function (e) {
    function t(e) {
      var n;
      return r(this, t), (n = m(this, l(t).call(this, e)))._initializeListener(), n
    }

    return c(t, e), i(t, [{
      key: "_initializeMembers", value: function (e) {
        this.expiredTimeLimit = 300, this.appid = e.appid || "", this.bucketName = e.bucketName || "", this.ciUrl = e.ciUrl || "", this.directory = e.directory || "", this.downloadUrl = e.downloadUrl || "", this.uploadUrl = e.uploadUrl || "", this.expiredTimeOut = e.expiredTimeOut || this.expiredTimeLimit, this.region = "ap-shanghai", this.cos = null, this.cosOptions = {
          secretId: e.secretId,
          secretKey: e.secretKey,
          sessionToken: e.sessionToken,
          expiredTime: e.expiredTime
        }, this._initUploaderMethod()
      }
    }, {
      key: "_expiredTimer", value: function () {
        var e = this, t = setInterval((function () {
          Math.ceil(Date.now() / 1e3) >= e.cosOptions.expiredTime - 20 && (e._isReady = !1, e._getAuthorizationKey(), clearInterval(t))
        }), 1e4)
      }
    }, {
      key: "_initializeListener", value: function () {
        this.tim.innerEmitter.on(zr, this._initialization, this)
      }
    }, {
      key: "_initialization", value: function () {
        this._initCOSSDKPlugin(), this.COSSDK ? (this._initializeMembers({}), this._getAuthorizationKey()) : z.warn("UploadController._initialization 没有检测到上传插件，将无法发送图片、音频、视频、文件等类型的消息。详细请参考 https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/SDK.html#registerPlugin")
      }
    }, {
      key: "_getAuthorizationKey", value: function () {
        var e = this, t = Math.ceil(Date.now() / 1e3),
          n = this.createPackage({name: "cosSig", action: "query", param: {duration: this.expiredTimeLimit}});
        this.tim.connectionController.request(n).then((function (n) {
          var r = n.data.expiredTime - t;
          n.data.expiredTimeOut = r, z.log("UploadController._getAuthorizationKey timeout=".concat(r, "s")), e._initializeMembers(n.data), e._expiredTimer(), e._initUploaderMethod()
        })).catch((function (e) {
          z.warn("UploadController._getAuthorizationKey. error:", e)
        }))
      }
    }, {
      key: "_initCOSSDKPlugin", value: function () {
        var e = E ? "cos-wx-sdk" : "cos-js-sdk";
        this.COSSDK = this.tim.getPlugin(e)
      }
    }, {
      key: "_initUploaderMethod", value: function () {
        var e = this;
        this.appid && (this.cos = E ? new this.COSSDK({
          ForcePathStyle: !0,
          getAuthorization: this._getAuthorization.bind(this)
        }) : new this.COSSDK({getAuthorization: this._getAuthorization.bind(this)}), this._cosUploadMethod = E ? function (t, n) {
          e.cos.postObject(t, n)
        } : function (t, n) {
          e.cos.uploadFiles(t, n)
        }, this.triggerReady())
      }
    }, {
      key: "_getAuthorization", value: function (e, t) {
        t({
          TmpSecretId: this.cosOptions.secretId,
          TmpSecretKey: this.cosOptions.secretKey,
          XCosSecurityToken: this.cosOptions.sessionToken,
          ExpiredTime: this.cosOptions.expiredTime
        })
      }
    }, {
      key: "uploadImage", value: function (e) {
        if (!e.file) return Zo(new lt({code: Tt, message: xn}));
        var t = this._checkImageType(e.file);
        if (!0 !== t) return t;
        var n = this._checkImageMime(e.file);
        if (!0 !== n) return n;
        var r = this._checkImageSize(e.file);
        return !0 !== r ? r : this.upload(e)
      }
    }, {
      key: "_checkImageType", value: function (e) {
        var t = "";
        return t = E ? e.url.slice(e.url.lastIndexOf(".") + 1) : e.files[0].name.slice(e.files[0].name.lastIndexOf(".") + 1), Ar.indexOf(t.toLowerCase()) >= 0 || Zo(new lt({
          coe: Et,
          message: Fn
        }))
      }
    }, {
      key: "_checkImageMime", value: function (e) {
        return !0
      }
    }, {
      key: "_checkImageSize", value: function (e) {
        var t = 0;
        return 0 === (t = E ? e.size : e.files[0].size) ? Zo(new lt({
          code: St,
          message: "".concat(Gn)
        })) : t < 20971520 || Zo(new lt({coe: wt, message: "".concat(Hn)}))
      }
    }, {
      key: "uploadFile", value: function (e) {
        var t = null;
        return e.file ? e.file.files[0].size > 104857600 ? (t = new lt({
          code: Gt,
          message: Wn
        }), Zo(t)) : 0 === e.file.files[0].size ? (t = new lt({
          code: St,
          message: "".concat(Gn)
        }), Zo(t)) : this.upload(e) : (t = new lt({code: Nt, message: zn}), Zo(t))
      }
    }, {
      key: "uploadVideo", value: function (e) {
        if (E) return e.file.videoFile.size > 20971520 ? Zo(new lt({
          code: Pt,
          message: "".concat(jn)
        })) : 0 === e.file.videoFile.size ? Zo(new lt({
          code: St,
          message: "".concat(Gn)
        })) : -1 === Rr.indexOf(e.file.videoFile.type) ? Zo(new lt({
          code: bt,
          message: "".concat($n)
        })) : this.handleVideoUpload({file: e.file.videoFile})
      }
    }, {
      key: "handleVideoUpload", value: function (e) {
        var t = this;
        return new Promise((function (n, r) {
          t.upload(e).then((function (e) {
            n(e)
          })).catch((function () {
            t.upload(e).then((function (e) {
              n(e)
            })).catch((function () {
              r(new lt({code: Lt, message: Vn}))
            }))
          }))
        }))
      }
    }, {
      key: "uploadAudio", value: function (e) {
        return e.file ? e.file.size > 20971520 ? Zo(new lt({
          code: Rt,
          message: "".concat(Kn)
        })) : 0 === e.file.size ? Zo(new lt({code: St, message: "".concat(Gn)})) : this.upload(e) : Zo(new lt({
          code: At,
          message: Bn
        }))
      }
    }, {
      key: "upload", value: function (e) {
        var t = this;
        if (!re(this._cosUploadMethod)) return z.warn("UploadController.upload 没有检测到上传插件，将无法发送图片、音频、视频、文件等类型的消息。详细请参考 https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/SDK.html#registerPlugin"), Zo(new lt({
          code: vt,
          message: Ln
        }));
        var n = new ui;
        n.setMethod(fi).setStart(), z.time(ai);
        var r = E ? e.file : e.file.files[0];
        return new Promise((function (o, i) {
          var s = E ? t._createCosOptionsWXMiniApp(e) : t._createCosOptionsWeb(e), a = t;
          t._cosUploadMethod(s, (function (e, s) {
            var u = Object.create(null);
            if (s) {
              if (t._isUploadError(s, e)) return i(s.files[0].error), z.warn("UploadController.upload failed, network error:".concat(s.files[0].error.error)), void n.setCode(Ot).setMessage(Yn).setEnd();
              u.fileName = r.name, u.fileSize = r.size, u.fileType = r.type.slice(r.type.indexOf("/") + 1).toLowerCase(), u.location = E ? s.Location : s.files[0].data.Location;
              var c = z.timeEnd(ai), l = a._formatFileSize(r.size), p = a._formatSpeed(1e3 * r.size / c),
                h = "size=".concat(l, ",time=").concat(c, "ms,speed=").concat(p);
              return z.log("UploadController.upload success name=".concat(r.name, ",").concat(h)), o(u), void n.setCode(0).setNetworkType(t.getNetworkType()).setText(h).setEnd()
            }
            n.setCode(Ot).setMessage(Yn).setEnd(), z.warn("UploadController.upload failed, error:".concat(e)), i(e)
          }))
        }))
      }
    }, {
      key: "_isUploadError", value: function (e, t) {
        return E ? !!t : null !== e.files[0].error
      }
    }, {
      key: "_formatFileSize", value: function (e) {
        return e < 1024 ? e + "B" : e < 1048576 ? Math.floor(e / 1024) + "KB" : Math.floor(e / 1048576) + "MB"
      }
    }, {
      key: "_formatSpeed", value: function (e) {
        return e <= 1048576 ? (e / 1024).toFixed(1) + "KB/s" : (e / 1048576).toFixed(1) + "MB/s"
      }
    }, {
      key: "_createCosOptionsWeb", value: function (e) {
        var t = this.tim.context.identifier, n = this._genFileName(t, e.to, e.file.files[0].name);
        return {
          files: [{
            Bucket: "".concat(this.bucketName, "-").concat(this.appid),
            Region: this.region,
            Key: "".concat(this.directory, "/").concat(n),
            Body: e.file.files[0]
          }], SliceSize: 1048576, onProgress: function (t) {
            if ("function" == typeof e.onProgress) try {
              e.onProgress(t.percent)
            } catch (n) {
              z.warn("onProgress callback error:"), z.error(n)
            }
          }, onFileFinish: function (e, t, n) {
          }
        }
      }
    }, {
      key: "_createCosOptionsWXMiniApp", value: function (e) {
        var t = this.tim.context.identifier, n = this._genFileName(t, e.to, e.file.name), r = e.file.url;
        return {
          Bucket: "".concat(this.bucketName, "-").concat(this.appid),
          Region: this.region,
          Key: "".concat(this.directory, "/").concat(n),
          FilePath: r,
          onProgress: function (t) {
            if (z.log(JSON.stringify(t)), "function" == typeof e.onProgress) try {
              e.onProgress(t.percent)
            } catch (n) {
              z.warn("onProgress callback error:"), z.error(n)
            }
          }
        }
      }
    }, {
      key: "_genFileName", value: function (e, t, n) {
        return "".concat(e, "-").concat(t, "-").concat(fe(99999), "-").concat(n)
      }
    }]), t
  }($o), Fu = function (e) {
    function n(e) {
      var t;
      return r(this, n), (t = m(this, l(n).call(this, e))).FILETYPE = {
        SOUND: 2106,
        FILE: 2107,
        VIDEO: 2113
      }, t._bdh_download_server = "grouptalk.c2c.qq.com", t._BDHBizID = 10001, t._authKey = "", t._expireTime = 0, t.tim.innerEmitter.on(zr, t._getAuthKey, d(t)), t
    }

    return c(n, e), i(n, [{
      key: "_getAuthKey", value: function () {
        var e = this, t = this.createPackage({name: "bigDataHallwayAuthKey", action: "query"});
        this.tim.connectionController.request(t).then((function (t) {
          t.data.authKey && (e._authKey = t.data.authKey, e._expireTime = parseInt(t.data.expireTime))
        }))
      }
    }, {
      key: "_isFromOlderVersion", value: function (e) {
        return 2 !== e.content.downloadFlag
      }
    }, {
      key: "parseElements", value: function (e, t) {
        if (!ee(e) || !t) return [];
        for (var n = [], r = null, o = 0; o < e.length; o++) r = e[o], this._needParse(r) ? n.push(this._parseElement(r, t)) : n.push(e[o]);
        return n
      }
    }, {
      key: "_needParse", value: function (e) {
        return !(!this._isFromOlderVersion(e) || e.type !== t.MSG_AUDIO && e.type !== t.MSG_FILE && e.type !== t.MSG_VIDEO)
      }
    }, {
      key: "_parseElement", value: function (e, n) {
        switch (e.type) {
          case t.MSG_AUDIO:
            return this._parseAudioElement(e, n);
          case t.MSG_FILE:
            return this._parseFileElement(e, n);
          case t.MSG_VIDEO:
            return this._parseVideoElement(e, n)
        }
      }
    }, {
      key: "_parseAudioElement", value: function (e, t) {
        return e.content.url = this._genAudioUrl(e.content.uuid, t), e
      }
    }, {
      key: "_parseFileElement", value: function (e, t) {
        return e.content.url = this._genFileUrl(e.content.uuid, t, e.content.fileName), e
      }
    }, {
      key: "_parseVideoElement", value: function (e, t) {
        return e.content.url = this._genVideoUrl(e.content.uuid, t), e
      }
    }, {
      key: "_genAudioUrl", value: function (e, t) {
        return "" === this._authKey ? (z.warn("BigDataHallwayController._genAudioUrl no authKey!"), "") : "https://".concat(this._bdh_download_server, "/asn.com/stddownload_common_file?authkey=").concat(this._authKey, "&bid=").concat(this._BDHBizID, "&subbid=").concat(this.tim.context.SDKAppID, "&fileid=").concat(e, "&filetype=").concat(this.FILETYPE.SOUND, "&openid=").concat(t, "&ver=0")
      }
    }, {
      key: "_genFileUrl", value: function (e, t, n) {
        return "" === this._authKey ? (z.warn("BigDataHallwayController._genFileUrl no authKey!"), "") : (n || (n = "".concat(Math.floor(1e5 * Math.random()), "-").concat(Date.now())), "https://".concat(this._bdh_download_server, "/asn.com/stddownload_common_file?authkey=").concat(this._authKey, "&bid=").concat(this._BDHBizID, "&subbid=").concat(this.tim.context.SDKAppID, "&fileid=").concat(e, "&filetype=").concat(this.FILETYPE.FILE, "&openid=").concat(t, "&ver=0&filename=").concat(encodeURIComponent(n)))
      }
    }, {
      key: "_genVideoUrl", value: function (e, t) {
        return "" === this._authKey ? (z.warn("BigDataHallwayController._genVideoUrl no authKey!"), "") : "https://".concat(this._bdh_download_server, "/asn.com/stddownload_common_file?authkey=").concat(this._authKey, "&bid=").concat(this._BDHBizID, "&subbid=").concat(this.tim.context.SDKAppID, "&fileid=").concat(e, "&filetype=").concat(this.FILETYPE.VIDEO, "&openid=").concat(t, "&ver=0")
      }
    }, {
      key: "reset", value: function () {
        this._authKey = "", this.expireTime = 0
      }
    }]), n
  }($o), Hu = {
    app_id: "",
    event_id: "",
    api_base: "https://pingtas.qq.com/pingd",
    prefix: "_mta_",
    version: "1.3.9",
    stat_share_app: !1,
    stat_pull_down_fresh: !1,
    stat_reach_bottom: !1,
    stat_param: !0
  };

  function Bu() {
    try {
      var e = "s" + Ku();
      return wx.setStorageSync(Hu.prefix + "ssid", e), e
    } catch (t) {
    }
  }

  function Ku(e) {
    for (var t = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], n = 10; 1 < n; n--) {
      var r = Math.floor(10 * Math.random()), o = t[r];
      t[r] = t[n - 1], t[n - 1] = o
    }
    for (n = r = 0; 5 > n; n++) r = 10 * r + t[n];
    return (e || "") + (r + "") + +new Date
  }

  function Vu() {
    try {
      var e = getCurrentPages(), t = "/";
      return 0 < e.length && (t = e.pop().__route__), t
    } catch (n) {
      console.log("get current page path error:" + n)
    }
  }

  function ju() {
    var e, t = {dm: "wechat.apps.xx", url: encodeURIComponent(Vu() + zu(Wu.Data.pageQuery)), pvi: "", si: "", ty: 0};
    return t.pvi = ((e = function () {
      try {
        return wx.getStorageSync(Hu.prefix + "auid")
      } catch (t) {
      }
    }()) || (e = function () {
      try {
        var t = Ku();
        return wx.setStorageSync(Hu.prefix + "auid", t), t
      } catch (e) {
      }
    }(), t.ty = 1), e), t.si = function () {
      var e = function () {
        try {
          return wx.getStorageSync(Hu.prefix + "ssid")
        } catch (e) {
        }
      }();
      return e || (e = Bu()), e
    }(), t
  }

  function $u() {
    var e = function () {
      var e = wx.getSystemInfoSync();
      return {
        adt: encodeURIComponent(e.model),
        scl: e.pixelRatio,
        scr: e.windowWidth + "x" + e.windowHeight,
        lg: e.language,
        fl: e.version,
        jv: encodeURIComponent(e.system),
        tz: encodeURIComponent(e.platform)
      }
    }();
    return function (e) {
      wx.getNetworkType({
        success: function (t) {
          e(t.networkType)
        }
      })
    }((function (e) {
      try {
        wx.setStorageSync(Hu.prefix + "ntdata", e)
      } catch (t) {
      }
    })), e.ct = wx.getStorageSync(Hu.prefix + "ntdata") || "4g", e
  }

  function Yu() {
    var e, t = Wu.Data.userInfo, n = [];
    for (e in t) t.hasOwnProperty(e) && n.push(e + "=" + t[e]);
    return t = n.join(";"), {
      r2: Hu.app_id,
      r4: "wx",
      ext: "v=" + Hu.version + (null !== t && "" !== t ? ";ui=" + encodeURIComponent(t) : "")
    }
  }

  function zu(e) {
    if (!Hu.stat_param || !e) return "";
    e = function (e) {
      if (1 > Hu.ignore_params.length) return e;
      var t, n = {};
      for (t in e) 0 <= Hu.ignore_params.indexOf(t) || (n[t] = e[t]);
      return n
    }(e);
    var t, n = [];
    for (t in e) n.push(t + "=" + e[t]);
    return 0 < n.length ? "?" + n.join("&") : ""
  }

  var Wu = {
    App: {
      init: function (e) {
        "appID" in e && (Hu.app_id = e.appID), "eventID" in e && (Hu.event_id = e.eventID), "statShareApp" in e && (Hu.stat_share_app = e.statShareApp), "statPullDownFresh" in e && (Hu.stat_pull_down_fresh = e.statPullDownFresh), "statReachBottom" in e && (Hu.stat_reach_bottom = e.statReachBottom), "ignoreParams" in e && (Hu.ignore_params = e.ignoreParams), "statParam" in e && (Hu.stat_param = e.statParam), Bu();
        try {
          "lauchOpts" in e && (Wu.Data.lanchInfo = e.lauchOpts, Wu.Data.lanchInfo.landing = 1)
        } catch (t) {
        }
        "autoReport" in e && e.autoReport && function () {
          var e = Page;
          Page = function (t) {
            var n = t.onLoad;
            t.onLoad = function (e) {
              n && n.call(this, e), Wu.Data.lastPageQuery = Wu.Data.pageQuery, Wu.Data.pageQuery = e, Wu.Data.lastPageUrl = Wu.Data.pageUrl, Wu.Data.pageUrl = Vu(), Wu.Data.show = !1, Wu.Page.init()
            }, e(t)
          }
        }()
      }
    },
    Page: {
      init: function () {
        var e, t = getCurrentPages()[getCurrentPages().length - 1];
        t.onShow && (e = t.onShow, t.onShow = function () {
          if (!0 === Wu.Data.show) {
            var t = Wu.Data.lastPageQuery;
            Wu.Data.lastPageQuery = Wu.Data.pageQuery, Wu.Data.pageQuery = t, Wu.Data.lastPageUrl = Wu.Data.pageUrl, Wu.Data.pageUrl = Vu()
          }
          Wu.Data.show = !0, Wu.Page.stat(), e.apply(this, arguments)
        }), Hu.stat_pull_down_fresh && t.onPullDownRefresh && function () {
          var e = t.onPullDownRefresh;
          t.onPullDownRefresh = function () {
            Wu.Event.stat(Hu.prefix + "pulldownfresh", {url: t.__route__}), e.apply(this, arguments)
          }
        }(), Hu.stat_reach_bottom && t.onReachBottom && function () {
          var e = t.onReachBottom;
          t.onReachBottom = function () {
            Wu.Event.stat(Hu.prefix + "reachbottom", {url: t.__route__}), e.apply(this, arguments)
          }
        }(), Hu.stat_share_app && t.onShareAppMessage && function () {
          var e = t.onShareAppMessage;
          t.onShareAppMessage = function () {
            return Wu.Event.stat(Hu.prefix + "shareapp", {url: t.__route__}), e.apply(this, arguments)
          }
        }()
      }, multiStat: function (e, t) {
        if (1 == t) Wu.Page.stat(e); else {
          var n = getCurrentPages()[getCurrentPages().length - 1];
          n.onShow && function () {
            var t = n.onShow;
            n.onShow = function () {
              Wu.Page.stat(e), t.call(this, arguments)
            }
          }()
        }
      }, stat: function (e) {
        if ("" != Hu.app_id) {
          var t = [], n = Yu();
          if (e && (n.r2 = e), e = [ju(), n, $u()], Wu.Data.lanchInfo) {
            e.push({ht: Wu.Data.lanchInfo.scene}), Wu.Data.pageQuery && Wu.Data.pageQuery._mta_ref_id && e.push({rarg: Wu.Data.pageQuery._mta_ref_id});
            try {
              1 == Wu.Data.lanchInfo.landing && (n.ext += ";lp=1", Wu.Data.lanchInfo.landing = 0)
            } catch (i) {
            }
          }
          e.push({
            rdm: "/",
            rurl: 0 >= Wu.Data.lastPageUrl.length ? Wu.Data.pageUrl + zu(Wu.Data.lastPageQuery) : encodeURIComponent(Wu.Data.lastPageUrl + zu(Wu.Data.lastPageQuery))
          }), e.push({rand: +new Date}), n = 0;
          for (var r = e.length; n < r; n++) for (var o in e[n]) e[n].hasOwnProperty(o) && t.push(o + "=" + (void 0 === e[n][o] ? "" : e[n][o]));
          wx.request({url: Hu.api_base + "?" + t.join("&").toLowerCase()})
        }
      }
    },
    Event: {
      stat: function (e, t) {
        if ("" != Hu.event_id) {
          var n = [], r = ju(), o = Yu();
          r.dm = "wxapps.click", r.url = e, o.r2 = Hu.event_id;
          var i, s = void 0 === t ? {} : t, a = [];
          for (i in s) s.hasOwnProperty(i) && a.push(encodeURIComponent(i) + "=" + encodeURIComponent(s[i]));
          for (s = a.join(";"), o.r5 = s, s = 0, o = (r = [r, o, $u(), {rand: +new Date}]).length; s < o; s++) for (var u in r[s]) r[s].hasOwnProperty(u) && n.push(u + "=" + (void 0 === r[s][u] ? "" : r[s][u]));
          wx.request({url: Hu.api_base + "?" + n.join("&").toLowerCase()})
        }
      }
    },
    Data: {
      userInfo: null,
      lanchInfo: null,
      pageQuery: null,
      lastPageQuery: null,
      pageUrl: "",
      lastPageUrl: "",
      show: !1
    }
  }, Xu = Wu, Ju = function () {
    function e() {
      r(this, e), this.cache = [], this.MtaWX = null, this._init()
    }

    return i(e, [{
      key: "report", value: function (e, t) {
        var n = this;
        try {
          T ? window.MtaH5 ? (window.MtaH5.clickStat(e, t), this.cache.forEach((function (e) {
            var t = e.name, r = e.param;
            window.MtaH5.clickStat(t, r), n.cache.shift()
          }))) : this.cache.push({
            name: e,
            param: t
          }) : E && (this.MtaWX ? (this.MtaWX.Event.stat(e, t), this.cache.forEach((function (e) {
            var t = e.name, r = e.param;
            n.MtaWX.stat(t, r), n.cache.shift()
          }))) : this.cache.push({name: e, param: t}))
        } catch (r) {
        }
      }
    }, {
      key: "stat", value: function () {
        try {
          T && window.MtaH5 ? window.MtaH5.pgv() : E && this.MtaWX && this.MtaWX.Page.stat()
        } catch (e) {
        }
      }
    }, {
      key: "_init", value: function () {
        try {
          if (T) {
            window._mtac = {autoReport: 0};
            var e = document.createElement("script"), t = ve();
            e.src = "".concat(t, "//pingjs.qq.com/h5/stats.js?v2.0.4"), e.setAttribute("name", "MTAH5"), e.setAttribute("sid", "500690998"), e.setAttribute("cid", "500691017");
            var n = document.getElementsByTagName("script")[0];
            n.parentNode.insertBefore(e, n)
          } else E && (this.MtaWX = Xu, this.MtaWX.App.init({
            appID: "500690995",
            eventID: "500691014",
            autoReport: !1,
            statParam: !0
          }))
        } catch (r) {
        }
      }
    }]), e
  }(), Qu = function (e) {
    function t(e) {
      var n;
      return r(this, t), (n = m(this, l(t).call(this, e))).tim = e, n.MTA = new Ju, n._initListener(), n
    }

    return c(t, e), i(t, [{
      key: "_initListener", value: function () {
        var e = this;
        this.tim.innerEmitter.on(xo, (function () {
          e.MTA.report("sdkappid", {value: e.tim.context.SDKAppID}), e.MTA.report("version", {value: hc.VERSION}), e.MTA.stat()
        }))
      }
    }]), t
  }($o), Zu = function () {
    function e(t) {
      r(this, e), this._table = "timwebii", this._report = []
    }

    return i(e, [{
      key: "pushIn", value: function (e) {
        z.debug("SSOLogBody.pushIn", this._report.length, e), this._report.push(e)
      }
    }, {
      key: "backfill", value: function (e) {
        var t;
        ee(e) && 0 !== e.length && (z.debug("SSOLogBody.backfill", this._report.length, e.length), (t = this._report).unshift.apply(t, v(e)))
      }
    }, {
      key: "getLogsNumInMemory", value: function () {
        return this._report.length
      }
    }, {
      key: "isEmpty", value: function () {
        return 0 === this._report.length
      }
    }, {
      key: "_reset", value: function () {
        this._report.length = 0, this._report = []
      }
    }, {
      key: "getTable", value: function () {
        return this._table
      }
    }, {
      key: "getLogsInMemory", value: function () {
        var e = this._report.slice();
        return this._reset(), e
      }
    }]), e
  }(), ec = function (e) {
    function t(e) {
      var n;
      return r(this, t), (n = m(this, l(t).call(this, e))).TAG = "im-ssolog-event", n._reportBody = new Zu, n._version = "2.4.2", n.MIN_THRESHOLD = 20, n.MAX_THRESHOLD = 100, n.WAITING_TIME = 6e4, n.INTERVAL = 2e4, n._timerID = 0, n._resetLastReportTime(), n._startReportTimer(), n._retryCount = 0, n.MAX_RETRY_COUNT = 3, n.tim.innerEmitter.on(Ao, n._onLoginSuccess, d(n)), n
    }

    return c(t, e), i(t, [{
      key: "reportAtOnce", value: function () {
        z.debug("EventStatController.reportAtOnce"), this._report()
      }
    }, {
      key: "_onLoginSuccess", value: function () {
        var e = this, t = this.tim.storage, n = t.getItem(this.TAG, !1);
        Te(n) || (z.log("EventStatController._onLoginSuccess get ssolog in storage, nums=" + n.length), n.forEach((function (t) {
          e._reportBody.pushIn(t)
        })), t.removeItem(this.TAG, !1))
      }
    }, {
      key: "pushIn", value: function (e) {
        e instanceof ui && (e.setCommonInfo(this.tim.context.SDKAppID, this._version, this.tim.context.tinyID, this.tim.loginInfo.identifier, this.getPlatform()), this._reportBody.pushIn(e), this._reportBody.getLogsNumInMemory() >= this.MIN_THRESHOLD && this._report())
      }
    }, {
      key: "_resetLastReportTime", value: function () {
        this._lastReportTime = Date.now()
      }
    }, {
      key: "_startReportTimer", value: function () {
        var e = this;
        this._timerID = setInterval((function () {
          Date.now() < e._lastReportTime + e.WAITING_TIME || e._reportBody.isEmpty() || e._report()
        }), this.INTERVAL)
      }
    }, {
      key: "_stopReportTimer", value: function () {
        this._timerID > 0 && (clearInterval(this._timerID), this._timerID = 0)
      }
    }, {
      key: "_report", value: function () {
        var e = this;
        if (!this._reportBody.isEmpty()) {
          var t = this._reportBody.getLogsInMemory(), n = this.createPackage({
            name: "ssoEventStat",
            action: "create",
            param: {table: this._reportBody.getTable(), report: t}
          });
          this.tim.connectionController.request(n).then((function () {
            e._resetLastReportTime(), e._retryCount > 0 && (z.debug("EventStatController.report retry success"), e._retryCount = 0)
          })).catch((function (n) {
            if (z.warn("EventStatController.report, online:".concat(e.getNetworkType(), " error:"), n), e._reportBody.backfill(t), e._reportBody.getLogsNumInMemory() > e.MAX_THRESHOLD || e._retryCount === e.MAX_RETRY_COUNT || 0 === e._timerID) return e._retryCount = 0, void e._flushAtOnce();
            e._retryCount += 1
          }))
        }
      }
    }, {
      key: "_flushAtOnce", value: function () {
        var e = this.tim.storage, t = e.getItem(this.TAG, !1), n = this._reportBody.getLogsInMemory();
        if (Te(t)) z.log("EventStatController._flushAtOnce nums=" + n.length), e.setItem(this.TAG, n, !0, !1); else {
          var r = n.concat(t);
          r.length > this.MAX_THRESHOLD && (r = r.slice(0, this.MAX_THRESHOLD)), z.log("EventStatController._flushAtOnce nums=" + r.length), e.setItem(this.TAG, r, !0, !1)
        }
      }
    }, {
      key: "reset", value: function () {
        z.log("EventStatController.reset"), this._stopReportTimer(), this._report()
      }
    }]), t
  }($o), tc = "none", nc = "online", rc = function () {
    function e() {
      r(this, e), this._networkType = "", this.maxWaitTime = 3e3
    }

    return i(e, [{
      key: "start", value: function () {
        var e = this;
        E ? (wx.getNetworkType({
          success: function (t) {
            e._networkType = t.networkType, t.networkType === tc ? z.warn("NetMonitor no network, please check!") : z.info("NetMonitor networkType:".concat(t.networkType))
          }
        }), wx.onNetworkStatusChange(this._onWxNetworkStatusChange.bind(this))) : this._networkType = nc
      }
    }, {
      key: "_onWxNetworkStatusChange", value: function (e) {
        this._networkType = e.networkType, e.isConnected ? z.info("NetMonitor networkType:".concat(e.networkType)) : z.warn("NetMonitor no network, please check!")
      }
    }, {
      key: "probe", value: function () {
        var e = this;
        return new Promise((function (t, n) {
          if (E) wx.getNetworkType({
            success: function (n) {
              e._networkType = n.networkType, n.networkType === tc ? (z.warn("NetMonitor no network, please check!"), t(!1, n.networkType)) : (z.info("NetMonitor networkType:".concat(n.networkType)), t(!0, n.networkType))
            }
          }); else if (window && window.fetch) fetch("".concat(ve(), "//webim-1252463788.file.myqcloud.com/assets/test/speed.xml?random=").concat(Math.random())).then((function (e) {
            e.ok ? t(!0, nc) : t(!1, tc)
          })).catch((function (e) {
            t(!1, tc)
          })); else {
            var r = new XMLHttpRequest, o = setTimeout((function () {
              z.warn("NetMonitor fetch timeout. Probably no network, please check!"), r.abort(), e._networkType = tc, t(!1, tc)
            }), e.maxWaitTime);
            r.onreadystatechange = function () {
              4 === r.readyState && (clearTimeout(o), 200 === r.status || 304 === r.status ? (this._networkType = nc, t(!0, nc)) : (z.warn("NetMonitor fetch status:".concat(r.status, ". Probably no network, please check!")), this._networkType = tc, t(!1, tc)))
            }, r.open("GET", "".concat(ve(), "//webim-1252463788.file.myqcloud.com/assets/test/speed.xml?random=").concat(Math.random())), r.send()
          }
        }))
      }
    }, {
      key: "getNetworkType", value: function () {
        return this._networkType
      }
    }, {
      key: "reset", value: function () {
        this._networkType = ""
      }
    }]), e
  }(), oc = function () {
    function e(t) {
      var n = this;
      r(this, e), ee(t) ? (this._map = new Map, t.forEach((function (e) {
        n._map.set(e, [])
      }))) : z.warn("AverageCalculator.constructor need keys")
    }

    return i(e, [{
      key: "push", value: function (e, t) {
        return !(te(e) || !this._map.has(e) || !X(t)) && (this._map.get(e).push(t), !0)
      }
    }, {
      key: "getSize", value: function (e) {
        return te(e) || !this._map.has(e) ? -1 : this._map.get(e).length
      }
    }, {
      key: "getAvg", value: function (e) {
        if (te(e) || !this._map.has(e)) return -1;
        var t = this._map.get(e), n = t.length;
        if (0 === n) return 0;
        var r = 0;
        return t.forEach((function (e) {
          r += e
        })), t.length = 0, this._map.set(e, []), parseInt(r / n)
      }
    }, {
      key: "getMax", value: function (e) {
        return te(e) || !this._map.has(e) ? -1 : Math.max.apply(null, this._map.get(e))
      }
    }, {
      key: "getMin", value: function (e) {
        return te(e) || !this._map.has(e) ? -1 : Math.min.apply(null, this._map.get(e))
      }
    }, {
      key: "reset", value: function () {
        this._map.forEach((function (e) {
          e.length = 0
        }))
      }
    }]), e
  }(), ic = function () {
    function e(t) {
      var n = this;
      r(this, e), ee(t) ? (this._map = new Map, t.forEach((function (e) {
        n._map.set(e, {totalCount: 0, successCount: 0})
      }))) : z.warn("SuccessRateCalculator.constructor need keys")
    }

    return i(e, [{
      key: "addTotalCount", value: function (e) {
        return !(te(e) || !this._map.has(e)) && (this._map.get(e).totalCount += 1, !0)
      }
    }, {
      key: "addSuccessCount", value: function (e) {
        return !(te(e) || !this._map.has(e)) && (this._map.get(e).successCount += 1, !0)
      }
    }, {
      key: "getSuccessRate", value: function (e) {
        if (te(e) || !this._map.has(e)) return -1;
        var t = this._map.get(e);
        if (0 === t.totalCount) return 1;
        var n = parseFloat((t.successCount / t.totalCount).toFixed(2));
        return t.totalCount = t.successCount = 0, n
      }
    }, {
      key: "getTotalCount", value: function (e) {
        return te(e) || !this._map.has(e) ? -1 : this._map.get(e).totalCount
      }
    }, {
      key: "reset", value: function () {
        this._map.forEach((function (e) {
          e.totalCount = 0, e.successCount = 0
        }))
      }
    }]), e
  }(), sc = function (e) {
    function t(e) {
      var n;
      return r(this, t), (n = m(this, l(t).call(this, e))).TABLE = "timwebsum", n.TAG = "im-ssolog-sumstat", n._items = [ni, ri, oi], n._thresholdMap = new Map, n._thresholdMap.set(ni, 100), n._thresholdMap.set(ri, 150), n._thresholdMap.set(oi, 15), n._lpID = "", n._platform = n.getPlatform(), n._lastReportTime = 0, n._statInfoArr = [], n._retryCount = 0, n._avgCalc = new oc(n._items), n._successRateCalc = new ic(n._items), n.tim.innerEmitter.on(Ao, n._onLoginSuccess, d(n)), n
    }

    return c(t, e), i(t, [{
      key: "_onLoginSuccess", value: function () {
        var e = this, t = this.tim.storage, n = t.getItem(this.TAG, !1);
        Te(n) || (z.log("SumStatController._onLoginSuccess get sumstatlog in storage, nums=" + n.length), n.forEach((function (t) {
          e._statInfoArr.pushIn(t)
        })), t.removeItem(this.TAG, !1))
      }
    }, {
      key: "recordLongPollingID", value: function (e) {
        this._lpID = e
      }
    }, {
      key: "addTotalCount", value: function (e) {
        this._successRateCalc.addTotalCount(e) ? 1 === this._successRateCalc.getTotalCount(e) && (this._lastReportTime = Date.now()) : z.warn("SumStatController.addTotalCount invalid key:", e)
      }
    }, {
      key: "addSuccessCount", value: function (e) {
        this._successRateCalc.addSuccessCount(e) || z.warn("SumStatController.addSuccessCount invalid key:", e)
      }
    }, {
      key: "addCost", value: function (e, t) {
        this._avgCalc.push(e, t) ? (z.debug("SumStatController.addCost", e, t, this._avgCalc.getSize(e)), this._avgCalc.getSize(e) >= this._thresholdMap.get(e) && this._report(e)) : z.warn("SumStatController.addCost invalid key or cost:", e, t)
      }
    }, {
      key: "_getItemNum", value: function (e) {
        switch (e) {
          case ni:
            return 1;
          case ri:
            return 2;
          case oi:
            return 3;
          default:
            return 100
        }
      }
    }, {
      key: "_getStatInfo", value: function (e) {
        var t = null;
        return this._avgCalc.getSize(e) > 0 && (t = {
          SDKAppID: "".concat(this.tim.context.SDKAppID),
          version: "".concat("2.4.2"),
          tinyID: this.tim.context.tinyID,
          userID: this.tim.loginInfo.identifier,
          item: this._getItemNum(e),
          lpID: e === ni ? this._lpID : "",
          platform: this._platform,
          networkType: this.getNetworkType(),
          total: this._successRateCalc.getTotalCount(e),
          successRate: this._successRateCalc.getSuccessRate(e),
          avg: this._avgCalc.getAvg(e),
          timespan: Date.now() - this._lastReportTime,
          time: pe()
        }), t
      }
    }, {
      key: "_report", value: function (e) {
        var t = this, n = [], r = null;
        te(e) ? this._items.forEach((function (e) {
          null !== (r = t._getStatInfo(e)) && n.push(r)
        })) : null !== (r = this._getStatInfo(e)) && n.push(r), z.debug("SumStatController._report", n), this._statInfoArr.length > 0 && (n = n.concat(this.statInfoArr), this._statInfoArr = []), this._doReport(n)
      }
    }, {
      key: "_doReport", value: function (e) {
        var t = this;
        if (Te(e)) z.warn("SumStatController._doReport statInfoArr is empty, do nothing"); else {
          var n = this.createPackage({name: "ssoSumStat", action: "create", param: {table: this.TABLE, report: e}});
          this.tim.connectionController.request(n).then((function () {
            t._lastReportTime = Date.now(), t._retryCount > 0 && (z.debug("SumStatController._doReport retry success"), t._retryCount = 0)
          })).catch((function (n) {
            z.warn("SumStatController._doReport, online:".concat(t.getNetworkType(), " error:"), n, e), t._retryCount <= 1 ? setTimeout((function () {
              z.info("SumStatController._doReport retry", e), t._retryCount += 1, t._doReport(e)
            }), 5e3) : (t._retryCount = 0, t._statInfoArr = t._statInfoArr.concat(e), t._flusgAtOnce())
          }))
        }
      }
    }, {
      key: "_flushAtOnce", value: function () {
        var e = this.tim.storage, t = e.getItem(this.TAG, !1), n = this._statInfoArr;
        if (Te(t)) z.log("SumStatController._flushAtOnce nums=" + n.length), e.setItem(this.TAG, n, !0, !1); else {
          var r = n.concat(t);
          r.length > 10 && (r = r.slice(0, 10)), z.log("SumStatController._flushAtOnce nums=" + r.length), e.setItem(this.TAG, r, !0, !1)
        }
        this._statInfoArr = []
      }
    }, {
      key: "reset", value: function () {
        z.info("SumStatController.reset"), this._report(), this._avgCalc.reset(), this._successRateCalc.reset()
      }
    }]), t
  }($o), ac = function () {
    function e() {
      r(this, e), this._funcMap = new Map
    }

    return i(e, [{
      key: "defense", value: function (e, t) {
        var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : void 0;
        if ("string" != typeof e) return null;
        if (0 === e.length) return null;
        if ("function" != typeof t) return null;
        if (this._funcMap.has(e) && this._funcMap.get(e).has(t)) return this._funcMap.get(e).get(t);
        this._funcMap.has(e) || this._funcMap.set(e, new Map);
        var r = null;
        return this._funcMap.get(e).has(t) ? r = this._funcMap.get(e).get(t) : (r = this._pack(t, n), this._funcMap.get(e).set(t, r)), r
      }
    }, {
      key: "defenseOnce", value: function (e) {
        var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : void 0;
        return "function" != typeof e ? null : this._pack(e, t)
      }
    }, {
      key: "find", value: function (e, t) {
        return "string" != typeof e || 0 === e.length ? null : "function" != typeof t ? null : this._funcMap.has(e) ? this._funcMap.get(e).has(t) ? this._funcMap.get(e).get(t) : (z.log("SafetyCallback.find: 找不到 func —— ".concat(e, "/").concat("" !== t.name ? t.name : "[anonymous]")), null) : (z.log("SafetyCallback.find: 找不到 eventName-".concat(e, " 对应的 func")), null)
      }
    }, {
      key: "delete", value: function (e, t) {
        return "function" == typeof t && (!!this._funcMap.has(e) && (!!this._funcMap.get(e).has(t) && (this._funcMap.get(e).delete(t), 0 === this._funcMap.get(e).size && this._funcMap.delete(e), !0)))
      }
    }, {
      key: "_pack", value: function (e, t) {
        return function () {
          try {
            e.apply(t, Array.from(arguments))
          } catch (n) {
            console.error(n)
          }
        }
      }
    }]), e
  }(), uc = function () {
    function t(e) {
      r(this, t);
      var n = new ui;
      n.setMethod(ci).setStart(), jo.mixin(this), this._initOptions(e), this._initMemberVariables(), this._initControllers(), this._initListener(), ui.bindController(this.eventStatController), n.setCode(0).setText("mp=".concat(E, "-ua=").concat(w)).setEnd(), z.info("SDK inWxMiniApp:".concat(E, ", SDKAppID:").concat(e.SDKAppID, ", UserAgent:").concat(w)), this._safetyCallbackFactory = new ac
    }

    return i(t, [{
      key: "login", value: function (e) {
        return z.time(ei), this._ssoLog = new ui, this._ssoLog.setMethod(li).setStart(), this.netMonitor.start(), this.loginInfo.identifier = e.identifier || e.userID, this.loginInfo.userSig = e.userSig, this.signController.login(this.loginInfo)
      }
    }, {
      key: "logout", value: function () {
        var e = this.signController.logout();
        return this.resetSDK(), e
      }
    }, {
      key: "on", value: function (e, t, n) {
        z.debug("on", "eventName:".concat(e)), this.outerEmitter.on(e, this._safetyCallbackFactory.defense(e, t, n), n)
      }
    }, {
      key: "once", value: function (e, t, n) {
        z.debug("once", "eventName:".concat(e)), this.outerEmitter.once(e, this._safetyCallbackFactory.defenseOnce(t, n), n || this)
      }
    }, {
      key: "off", value: function (e, t, n, r) {
        z.debug("off", "eventName:".concat(e));
        var o = this._safetyCallbackFactory.find(e, t);
        null !== o && (this.outerEmitter.off(e, o, n, r), this._safetyCallbackFactory.delete(e, t))
      }
    }, {
      key: "registerPlugin", value: function (e) {
        var t = this;
        this.plugins || (this.plugins = {}), Object.keys(e).forEach((function (n) {
          t.plugins[n] = e[n]
        }))
      }
    }, {
      key: "getPlugin", value: function (e) {
        return this.plugins[e] || void 0
      }
    }, {
      key: "setLogLevel", value: function (e) {
        if (e <= 0) {
          console.log(["", " ________  ______  __       __  __       __  ________  _______", "|        \\|      \\|  \\     /  \\|  \\  _  |  \\|        \\|       \\", " \\$$$$$$$$ \\$$$$$$| $$\\   /  $$| $$ / \\ | $$| $$$$$$$$| $$$$$$$\\", "   | $$     | $$  | $$$\\ /  $$$| $$/  $\\| $$| $$__    | $$__/ $$", "   | $$     | $$  | $$$$\\  $$$$| $$  $$$\\ $$| $$  \\   | $$    $$", "   | $$     | $$  | $$\\$$ $$ $$| $$ $$\\$$\\$$| $$$$$   | $$$$$$$\\", "   | $$    _| $$_ | $$ \\$$$| $$| $$$$  \\$$$$| $$_____ | $$__/ $$", "   | $$   |   $$ \\| $$  \\$ | $$| $$$    \\$$$| $$     \\| $$    $$", "    \\$$    \\$$$$$$ \\$$      \\$$ \\$$      \\$$ \\$$$$$$$$ \\$$$$$$$", "", ""].join("\n")), console.log("%cIM 智能客服，随时随地解决您的问题 →_→ https://cloud.tencent.com/act/event/smarty-service?from=im-doc", "color:#ff0000");
          console.log(["", "参考以下文档，会更快解决问题哦！(#^.^#)\n", "SDK 更新日志: https://cloud.tencent.com/document/product/269/38492\n", "SDK 接口文档: https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/SDK.html\n", "常见问题: https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/tutorial-01-faq.html\n", "反馈问题？戳我提 issue: https://github.com/tencentyun/TIMSDK/issues\n", "如果您需要在生产环境关闭上面的日志，请 tim.setLogLevel(1)\n"].join("\n"))
        }
        z.setLevel(e)
      }
    }, {
      key: "downloadLog", value: function () {
        var e = document.createElement("a"), t = new Date, n = new Blob(this.getLog());
        e.download = "TIM-" + t.getFullYear() + "-" + (t.getMonth() + 1) + "-" + t.getDate() + "-" + this.loginInfo.SDKAppID + "-" + this.context.identifier + ".txt", e.href = URL.createObjectURL(n), e.click(), URL.revokeObjectURL(n)
      }
    }, {
      key: "destroy", value: function () {
        this.logout(), this.outerEmitter.emit(e.SDK_DESTROY, {SDKAppID: this.loginInfo.SDKAppID})
      }
    }, {
      key: "createTextMessage", value: function (e) {
        return this.messageController.createTextMessage(e)
      }
    }, {
      key: "createImageMessage", value: function (e) {
        return this.messageController.createImageMessage(e)
      }
    }, {
      key: "createAudioMessage", value: function (e) {
        return this.messageController.createAudioMessage(e)
      }
    }, {
      key: "createVideoMessage", value: function (e) {
        return this.messageController.createVideoMessage(e)
      }
    }, {
      key: "createCustomMessage", value: function (e) {
        return this.messageController.createCustomMessage(e)
      }
    }, {
      key: "createFaceMessage", value: function (e) {
        return this.messageController.createFaceMessage(e)
      }
    }, {
      key: "createFileMessage", value: function (e) {
        return this.messageController.createFileMessage(e)
      }
    }, {
      key: "sendMessage", value: function (e) {
        return e instanceof Gr ? this.messageController.sendMessageInstance(e) : Zo(new lt({code: Ct, message: On}))
      }
    }, {
      key: "revokeMessage", value: function (e) {
        return this.messageController.revokeMessage(e)
      }
    }, {
      key: "resendMessage", value: function (e) {
        return this.messageController.resendMessage(e)
      }
    }, {
      key: "getMessageList", value: function (e) {
        return this.messageController.getMessageList(e)
      }
    }, {
      key: "setMessageRead", value: function (e) {
        return this.messageController.setMessageRead(e)
      }
    }, {
      key: "getConversationList", value: function () {
        return this.conversationController.getConversationList()
      }
    }, {
      key: "getConversationProfile", value: function (e) {
        return this.conversationController.getConversationProfile(e)
      }
    }, {
      key: "deleteConversation", value: function (e) {
        return this.conversationController.deleteConversation(e)
      }
    }, {
      key: "getMyProfile", value: function () {
        return this.userController.getMyProfile()
      }
    }, {
      key: "getUserProfile", value: function (e) {
        return this.userController.getUserProfile(e)
      }
    }, {
      key: "updateMyProfile", value: function (e) {
        return this.userController.updateMyProfile(e)
      }
    }, {
      key: "getFriendList", value: function () {
        return this.userController.getFriendList()
      }
    }, {
      key: "deleteFriend", value: function (e) {
        return this.userController.deleteFriend(e)
      }
    }, {
      key: "getBlacklist", value: function () {
        return this.userController.getBlacklist()
      }
    }, {
      key: "addToBlacklist", value: function (e) {
        return this.userController.addBlacklist(e)
      }
    }, {
      key: "removeFromBlacklist", value: function (e) {
        return this.userController.deleteBlacklist(e)
      }
    }, {
      key: "getGroupList", value: function (e) {
        return this.groupController.getGroupList(e)
      }
    }, {
      key: "getGroupProfile", value: function (e) {
        return this.groupController.getGroupProfile(e)
      }
    }, {
      key: "createGroup", value: function (e) {
        return this.groupController.createGroup(e)
      }
    }, {
      key: "dismissGroup", value: function (e) {
        return this.groupController.dismissGroup(e)
      }
    }, {
      key: "updateGroupProfile", value: function (e) {
        return this.groupController.updateGroupProfile(e)
      }
    }, {
      key: "joinGroup", value: function (e) {
        return this.groupController.joinGroup(e)
      }
    }, {
      key: "quitGroup", value: function (e) {
        return this.groupController.quitGroup(e)
      }
    }, {
      key: "searchGroupByID", value: function (e) {
        return this.groupController.searchGroupByID(e)
      }
    }, {
      key: "changeGroupOwner", value: function (e) {
        return this.groupController.changeGroupOwner(e)
      }
    }, {
      key: "handleGroupApplication", value: function (e) {
        return this.groupController.handleGroupApplication(e)
      }
    }, {
      key: "setMessageRemindType", value: function (e) {
        return this.groupController.setMessageRemindType(e)
      }
    }, {
      key: "getGroupMemberList", value: function (e) {
        return this.groupController.getGroupMemberList(e)
      }
    }, {
      key: "getGroupMemberProfile", value: function (e) {
        return this.groupController.getGroupMemberProfile(e)
      }
    }, {
      key: "addGroupMember", value: function (e) {
        return this.groupController.addGroupMember(e)
      }
    }, {
      key: "deleteGroupMember", value: function (e) {
        return this.groupController.deleteGroupMember(e)
      }
    }, {
      key: "setGroupMemberMuteTime", value: function (e) {
        return this.groupController.setGroupMemberMuteTime(e)
      }
    }, {
      key: "setGroupMemberRole", value: function (e) {
        return this.groupController.setGroupMemberRole(e)
      }
    }, {
      key: "setGroupMemberNameCard", value: function (e) {
        return this.groupController.setGroupMemberNameCard(e)
      }
    }, {
      key: "setGroupMemberCustomField", value: function (e) {
        return this.groupController.setGroupMemberCustomField(e)
      }
    }, {
      key: "_initOptions", value: function (e) {
        this.plugins = {}, this.loginInfo = {
          SDKAppID: e.SDKAppID || null,
          accountType: fe(),
          identifier: null,
          userSig: null
        }, this.options = {runLoopNetType: e.runLoopNetType || We, enablePointer: e.enablePointer || !1}
      }
    }, {
      key: "_initMemberVariables", value: function () {
        this.context = null, this.innerEmitter = new Ou, this.outerEmitter = new Ou, Jo(this.outerEmitter), this.packageConfig = new Gu(this), this.storage = new bu(this), this.netMonitor = new rc, this.outerEmitter._emit = this.outerEmitter.emit, this.outerEmitter.emit = function (e, t) {
          var n = arguments[0], r = [n, {name: arguments[0], data: arguments[1]}];
          z.debug("emit ".concat(n), r[1]), this.outerEmitter._emit.apply(this.outerEmitter, r)
        }.bind(this)
      }
    }, {
      key: "_initControllers", value: function () {
        this.exceptionController = new tu(this), this.connectionController = new eu(this), this.contextController = new zo(this), this.signController = new Fi(this), this.messageController = new Iu(this), this.conversationController = new du(this), this.userController = new lu(this), this.groupController = new wu(this), this.notificationController = new qu(this), this.bigDataHallwayController = new Fu(this), this.statusController = new Lu(this), this.uploadController = new xu(this), this.eventStatController = new ec(this), this.sumStatController = new sc(this), this.mtaReportController = new Qu(this), this._initReadyListener()
      }
    }, {
      key: "_initListener", value: function () {
        var e = this;
        if (this.innerEmitter.on(po, this._onNoticeChannelReconnectedAfterLongTime, this), E && "function" == typeof wx.onAppShow && "function" == typeof wx.onAppHide) {
          var t = null;
          wx.onAppHide((function () {
            (t = new ui).setMethod(xi).setStart()
          })), wx.onAppShow((function () {
            null !== t && t.setCode(0).setNetworkType(e.netMonitor.getNetworkType()).setEnd()
          }))
        }
      }
    }, {
      key: "_initReadyListener", value: function () {
        for (var e = this, t = this.readyList, n = 0, r = t.length; n < r; n++) this[t[n]].ready((function () {
          return e._readyHandle()
        }))
      }
    }, {
      key: "_onNoticeChannelReconnectedAfterLongTime", value: function (e) {
        z.log("reconnect after long time...", e), this.notificationController.closeNoticeChannel(), this.resetSDK(), this.login(this.loginInfo)
      }
    }, {
      key: "resetSDK", value: function () {
        var t = this;
        this.initList.forEach((function (e) {
          t[e].reset && t[e].reset()
        })), this.netMonitor.reset(), this.storage.reset(), this.resetReady(), this._initReadyListener(), this.outerEmitter.emit(e.SDK_NOT_READY)
      }
    }, {
      key: "_readyHandle", value: function () {
        for (var t = this.readyList, n = !0, r = 0, o = t.length; r < o; r++) if (!this[t[r]].isReady()) {
          n = !1;
          break
        }
        if (n) {
          var i = z.timeEnd(ei);
          z.warn("SDK is ready. cost=".concat(i, "ms")), this.triggerReady(), this.innerEmitter.emit(xo), this.outerEmitter.emit(e.SDK_READY), this._ssoLog.setCode(0).setNetworkType(this.netMonitor.getNetworkType()).setText(i).setEnd()
        }
      }
    }]), t
  }();
  uc.prototype.readyList = ["conversationController"], uc.prototype.initList = ["exceptionController", "connectionController", "signController", "contextController", "messageController", "conversationController", "userController", "groupController", "notificationController", "eventStatController", "sumStatController"];
  var cc = {
    login: "login",
    on: "on",
    off: "off",
    ready: "ready",
    setLogLevel: "setLogLevel",
    joinGroup: "joinGroup",
    quitGroup: "quitGroup",
    registerPlugin: "registerPlugin"
  };

  function lc(e, t) {
    return !(!e.isReady() && void 0 === cc[t]) || (e.innerEmitter.emit(bo, new lt({
      code: _n,
      message: "".concat(t, " ").concat(wr, "，请参考 https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/module-EVENT.html#.SDK_READY")
    })), !1)
  }

  var pc = {}, hc = {};
  return hc.create = function (t) {
    if (t.SDKAppID && pc[t.SDKAppID]) return pc[t.SDKAppID];
    z.log("TIM.create");
    var n = new uc(t);
    n.on(e.SDK_DESTROY, (function (e) {
      pc[e.data.SDKAppID] = null, delete pc[e.data.SDKAppID]
    }));
    var r = function (e) {
      var t = Object.create(null);
      return Object.keys(qr).forEach((function (n) {
        if (e[n]) {
          var r = qr[n], o = new _;
          t[r] = function () {
            var t = Array.from(arguments);
            return o.use((function (t, r) {
              if (lc(e, n)) return r()
            })).use((function (e, t) {
              if (!0 === Ee(e, Ur[n], r)) return t()
            })).use((function (t, r) {
              return e[n].apply(e, t)
            })), o.run(t)
          }
        }
      })), t
    }(n);
    return pc[t.SDKAppID] = r, z.log("TIM.create ok"), r
  }, hc.TYPES = t, hc.EVENT = e, hc.VERSION = "2.4.2", z.log("TIM.VERSION: ".concat(hc.VERSION)), hc
}));
